Metricool Affiliations API

The Affiliations API from Metricool — 12 operation(s) for affiliations.

Operations 16

GET /v2/affiliation/{userId} Get affiliation properties for a user #
GET /v2/affiliation/{userId}/distributions/countries Get affiliate link visits distribution by country #
GET /v2/affiliation/{userId}/distributions/referers Get affiliate link visits distribution by referer #
GET /v2/affiliation/{userId}/links/{linkId}/timelines Get timelines for a specific affiliate link #
GET /v2/affiliation/{userId}/payments List affiliation payments for a user #
GET /v2/affiliation/{userId}/timelines Get affiliate timelines #
GET /v2/affiliation/{userid}/coupons List affiliate coupons for a user #
POST /v2/affiliation/{userid}/coupons Create a new affiliate coupon #
DELETE /v2/affiliation/{userid}/coupons/{couponId} Delete an affiliate coupon #
PUT /v2/affiliation/{userid}/coupons/{couponid}/statuses Update the status of an affiliate coupon #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/metricool:metricool-affiliations-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

metricool-affiliations-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Metricool Affiliations API
  description: 'Metricool API


    The base URL for all endpoints is: https://app.metricool.com/api


    All endpoints require authentication.'
  version: 2.0.0
servers:
- url: https://app.metricool.com/api
tags:
- name: Affiliations
paths:
  /v2/affiliation/links:
    get:
      tags:
      - Affiliations
      summary: Check availability of an affiliate link identifier
      description: Checks whether a link hash, destination URL, or link name is already taken. Exactly one of the three query parameters must be provided. Returns 200 with the value if taken, or 404 if available.
      operationId: findLink
      parameters:
      - name: hash
        in: query
        description: Affiliate link hash/slug to check
        required: false
        schema:
          type: string
      - name: destination
        in: query
        description: Destination URL to check
        required: false
        schema:
          type: string
      - name: name
        in: query
        description: Link name to check uniqueness
        required: false
        schema:
          type: string
      responses:
        '200':
          description: The provided identifier is already taken
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseString'
        '400':
          description: Not exactly one parameter provided
        '403':
          description: Unauthorized user or affiliate is banned
        '404':
          description: The provided identifier is available
  /v2/affiliation/{userId}:
    get:
      tags:
      - Affiliations
      summary: Get affiliation properties for a user
      operationId: get
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Affiliation properties retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseAffiliationPropertiesDto'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/distributions/countries:
    get:
      tags:
      - Affiliations
      summary: Get affiliate link visits distribution by country
      description: Returns the geographic distribution of affiliate link visitors grouped by country within a date range.
      operationId: getAffiliateLinkVisitsPerCoutry
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: from
        in: query
        description: Start date and time in ISO 8601 format, e.g. 2021-01-01T00:00:00+01:00
        required: true
        schema:
          type: string
      - name: to
        in: query
        description: End date and time in ISO 8601 format, e.g. 2021-12-31T23:59:59+01:00
        required: true
        schema:
          type: string
      - name: timezone
        in: query
        description: IANA timezone identifier, e.g. Europe/Madrid
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Country distribution retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseDistributionItem'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/distributions/referers:
    get:
      tags:
      - Affiliations
      summary: Get affiliate link visits distribution by referer
      description: Returns the distribution of affiliate link visitors grouped by referring source within a date range.
      operationId: getAffiliateLinkVisitReferers
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: from
        in: query
        description: Start date and time in ISO 8601 format, e.g. 2021-01-01T00:00:00+01:00
        required: true
        schema:
          type: string
      - name: to
        in: query
        description: End date and time in ISO 8601 format, e.g. 2021-12-31T23:59:59+01:00
        required: true
        schema:
          type: string
      - name: timezone
        in: query
        description: IANA timezone identifier, e.g. Europe/Madrid
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Referer distribution retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseDistributionItem'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/links:
    get:
      tags:
      - Affiliations
      summary: List affiliate links for a user
      operationId: getAffiliateLinks
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: status
        in: query
        description: 'Filter by link status: active, deleted, or all. Defaults to active'
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Links retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseAffiliateLinkDto'
        '403':
          description: User not authorized or affiliate is banned
    post:
      tags:
      - Affiliations
      summary: Create a new affiliate link
      operationId: createAffiliateLink
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      requestBody:
        description: Affiliate link to create
      responses:
        '200':
          description: Link created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseAffiliateLinkDto'
        '400':
          description: Invalid landing path
        '403':
          description: User not authorized or affiliate is banned
        '409':
          description: Slug or name already in use
    patch:
      tags:
      - Affiliations
      summary: Update legacy affiliation link properties
      operationId: updateLink
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: fields
        in: query
        description: List of fields to update (e.g. hash, destination)
        required: true
        schema:
          type: array
          items:
            type: string
      requestBody:
        description: Fields and values to update
      responses:
        '200':
          description: Link properties updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseUpdateAffiliationLinkResponse'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/links/{linkId}:
    put:
      tags:
      - Affiliations
      summary: Update an affiliate link
      operationId: updateAffiliateLink
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: linkId
        in: path
        description: ID of the affiliate link to update
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        description: Updated link data
      responses:
        '200':
          description: Link updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseAffiliateLinkDto'
        '403':
          description: User not authorized or affiliate is banned
        '404':
          description: Affiliate link not found
        '409':
          description: Link name already in use
    delete:
      tags:
      - Affiliations
      summary: Delete an affiliate link
      operationId: deleteAffiliateLink
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: linkId
        in: path
        description: ID of the affiliate link to delete
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Link deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseBoolean'
        '403':
          description: User not authorized or affiliate is banned
        '404':
          description: Affiliate link not found
        '409':
          description: Cannot delete the last affiliate link
  /v2/affiliation/{userId}/links/{linkId}/timelines:
    get:
      tags:
      - Affiliations
      summary: Get timelines for a specific affiliate link
      description: Returns a daily time series for the specified metric filtered by a specific affiliate link.
      operationId: getLinkTimelines
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: linkId
        in: path
        description: ID of the affiliate link
        required: true
        schema:
          type: integer
          format: int64
      - name: from
        in: query
        description: Start date and time in ISO 8601 format, e.g. 2021-01-01T00:00:00+01:00
        required: true
        schema:
          type: string
      - name: to
        in: query
        description: End date and time in ISO 8601 format, e.g. 2021-12-31T23:59:59+01:00
        required: true
        schema:
          type: string
      - name: timezone
        in: query
        description: IANA timezone identifier, e.g. Europe/Madrid
        required: false
        schema:
          type: string
      - name: metric
        in: query
        description: 'Metric to retrieve: signups, clicks, or paid_users'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Timeline data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseTimelineSeries'
        '400':
          description: Unsupported metric provided
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/payments:
    get:
      tags:
      - Affiliations
      summary: List affiliation payments for a user
      operationId: getAffiliationPayments
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: from
        in: query
        description: From Date and time ISO 8601 format. e.g. 2021-01-01T10:00:00+01:00 (optional, if not provided returns all from the beginning)
        required: false
        schema:
          type: string
      - name: to
        in: query
        description: To Date and time in ISO 8601 format. e.g. 2021-09-10T03:30:00+01:00 (optional, if not provided returns all until now)
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Payments retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseAffiliationPaymentDto'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userId}/timelines:
    get:
      tags:
      - Affiliations
      summary: Get affiliate timelines
      description: Returns a daily time series for the specified metric (signups, clicks, or paid_users) within a date range.
      operationId: getTimelines
      parameters:
      - name: userId
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: from
        in: query
        description: Start date and time in ISO 8601 format, e.g. 2021-01-01T00:00:00+01:00
        required: true
        schema:
          type: string
      - name: to
        in: query
        description: End date and time in ISO 8601 format, e.g. 2021-12-31T23:59:59+01:00
        required: true
        schema:
          type: string
      - name: timezone
        in: query
        description: IANA timezone identifier, e.g. Europe/Madrid
        required: false
        schema:
          type: string
      - name: metric
        in: query
        description: 'Metric to retrieve: signups, clicks, or paid_users'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Timeline data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseTimelineSeries'
        '400':
          description: Unsupported metric provided
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userid}/coupons:
    get:
      tags:
      - Affiliations
      summary: List affiliate coupons for a user
      operationId: getAffiliateCoupons
      parameters:
      - name: userid
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Coupons retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkListResponseAffiliateCoupon'
        '403':
          description: User not authorized or affiliate is banned
    post:
      tags:
      - Affiliations
      summary: Create a new affiliate coupon
      operationId: createAffiliateCoupon
      parameters:
      - name: userid
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      requestBody:
        description: Coupon to create
      responses:
        '200':
          description: Coupon created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseAffiliateCoupon'
        '400':
          description: Coupon code already exists
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userid}/coupons/{couponId}:
    delete:
      tags:
      - Affiliations
      summary: Delete an affiliate coupon
      operationId: deleteAffiliateCoupon
      parameters:
      - name: userid
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: couponId
        in: path
        description: ID of the coupon to delete
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: Coupon deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseBoolean'
        '403':
          description: User not authorized or affiliate is banned
  /v2/affiliation/{userid}/coupons/{couponid}/statuses:
    put:
      tags:
      - Affiliations
      summary: Update the status of an affiliate coupon
      operationId: updateAffiliateCouponsStatuses
      parameters:
      - name: userid
        in: path
        description: ID of the affiliate user
        required: true
        schema:
          type: integer
          format: int32
      - name: couponid
        in: path
        description: ID of the coupon to update
        required: true
        schema:
          type: integer
          format: int32
      requestBody:
        description: New status for the coupon
      responses:
        '200':
          description: Coupon status updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonOkResponseBoolean'
        '400':
          description: Coupon not found
        '403':
          description: User not authorized or affiliate is banned
components:
  schemas:
    JsonOkListResponseAffiliateCoupon:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: array
          items:
            $ref: '#/components/schemas/AffiliateCoupon'
    AffiliateLinkDto:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier of the link
          format: int64
          example: 1234
        name:
          type: string
          description: Display name of the link
          example: Link 1
        slug:
          type: string
          description: Slug used to build the public short link
          example: summer-promo
        landingPath:
          type: string
          description: Landing path on metricool.com the link points to
          example: pricing
        createdAt:
          $ref: '#/components/schemas/DateTimeInfo'
        deleted:
          type: boolean
          description: Whether the link has been deleted (kept for statistics)
          example: false
      description: Affiliate link information
    JsonOkResponseUpdateAffiliationLinkResponse:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          $ref: '#/components/schemas/UpdateAffiliationLinkResponse'
    TimelineAggregate:
      type: object
      properties:
        aggregation:
          type: string
        value:
          type: number
          format: double
    JsonOkListResponseTimelineSeries:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: array
          items:
            $ref: '#/components/schemas/TimelineSeries'
    AffiliateTier:
      type: object
      properties:
        currentLevel:
          type: string
          description: 'Current affiliate tier level: tier_1 or tier_2'
          example: tier_1
      description: Affiliate tier information
    JsonOkResponseBoolean:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: boolean
    JsonPaging:
      type: object
      properties:
        next:
          type: string
    TimelineSeries:
      type: object
      properties:
        metric:
          type: string
        values:
          type: array
          items:
            $ref: '#/components/schemas/SeriesValue'
        aggregate:
          $ref: '#/components/schemas/TimelineAggregate'
    AffiliationPaymentDto:
      required:
      - amount
      - date
      type: object
      properties:
        date:
          type: string
          description: Payment date and time
          format: date-time
        amount:
          type: number
          description: Payment amount
          format: double
          example: 150.5
        status:
          type: string
          description: Payment status. "refunded" when the payment was reversed due to a failed charge; absent otherwise
          example: refunded
      description: Affiliation payment information
    JsonOkResponseAffiliateCoupon:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          $ref: '#/components/schemas/AffiliateCoupon'
    JsonOkListResponseDistributionItem:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: array
          items:
            $ref: '#/components/schemas/DistributionItem'
    JsonOkResponseAffiliationPropertiesDto:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          $ref: '#/components/schemas/AffiliationPropertiesDto'
    UpdateAffiliationLinkResponse:
      type: object
      properties:
        hash:
          type: string
          description: Updated hash/slug of the link
        destination:
          type: string
          description: Updated destination URL of the link
      description: Response after updating a legacy affiliation link
    AffiliateCoupon:
      type: object
      properties:
        id:
          type: integer
          description: Unique coupon identifier
          format: int32
        code:
          type: string
          description: Coupon code
          example: SUMMER2025
        uses:
          type: integer
          description: Number of times this coupon has been used
          format: int32
        creation:
          $ref: '#/components/schemas/DateTimeInfo'
        status:
          type: string
          description: 'Current coupon status: enabled or disabled'
          example: enabled
      description: Affiliate coupon details
    SeriesValue:
      type: object
      properties:
        dateTime:
          type: string
          format: date-time
        value:
          type: number
          format: double
    JsonOkResponseAffiliateLinkDto:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          $ref: '#/components/schemas/AffiliateLinkDto'
    AffiliationPropertiesDto:
      type: object
      properties:
        maxEarnPerReference:
          type: integer
          description: Maximum earnings per referred user in USD
          format: int32
        affiliationPercentCommission:
          type: integer
          description: Commission percentage for affiliations
          format: int32
        totalClicks:
          type: integer
          description: Total number of clicks on affiliate links (active and deleted)
          format: int32
        affiliationEarned:
          type: number
          description: Total amount earned from affiliations in USD
          format: double
        affiliationPayed:
          type: number
          description: Total amount paid out from affiliations in USD
          format: double
        referencedUsersCount:
          type: integer
          description: Total number of referred users who signed up
          format: int64
        paidUsers:
          type: integer
          description: Number of referred users who became paying customers
          format: int64
        totalLinks:
          type: integer
          description: Number of active affiliate links
          format: int32
        tier:
          $ref: '#/components/schemas/AffiliateTier'
        banned:
          type: boolean
          description: Whether the affiliate is banned
      description: Affiliation properties and aggregate metrics for a user
    DistributionItem:
      type: object
      properties:
        key:
          type: string
        value:
          type: number
          format: double
    JsonOkListResponseAffiliationPaymentDto:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: array
          items:
            $ref: '#/components/schemas/AffiliationPaymentDto'
    DateTimeInfo:
      required:
      - dateTime
      type: object
      properties:
        dateTime:
          type: string
          description: 'Local Date-time represented with a certain timezone '
        timezone:
          type: string
          description: Timezone applied to the datetime
    JsonOkListResponseAffiliateLinkDto:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: array
          items:
            $ref: '#/components/schemas/AffiliateLinkDto'
    JsonOkResponseString:
      type: object
      properties:
        metadata:
          type: object
        page:
          $ref: '#/components/schemas/JsonPaging'
        data:
          type: string