AffiliateRail Customers API

The Customers API from AffiliateRail — 2 operation(s) for customers.

Operations 5

GET /v1/customers List customers #
POST /v1/customers Create a customer #
GET /v1/customers/{id} Retrieve a customer #
POST /v1/customers/{id} Update a customer #
DELETE /v1/customers/{id} Delete a customer #

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/affiliaterail-com:affiliaterail-com-customers-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

affiliaterail-com-customers-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Affiliaterail Com Customers API
  version: '2026-08-21'
  description: 'Operations tagged Customers across 2 of this provider''s published API definitions: affiliaterail-com-docs-openapi.json, affiliaterail-com-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.affiliaterail.com
  description: Production
tags:
- name: Customers
paths:
  /v1/customers:
    get:
      tags:
      - Customers
      summary: List customers
      description: 'Six explicit statuses, `refunded` included. The envelope is the same flat `{ data, has_more, total_count }` as every other list.


        **Scope:** `read`'
      security:
      - bearerAuth: []
      parameters:
      - schema:
          type: string
          example: prg_7uSyy9FqVLCFWrdPeZaK
          description: Required on every list
        required: true
        description: Required on every list
        name: program_id
        in: query
      - schema:
          type: string
          example: '25'
          description: 1 to 100, default 25
        required: false
        description: 1 to 100, default 25
        name: limit
        in: query
      - schema:
          type: string
          description: Object id; returns the page after it (older)
        required: false
        description: Object id; returns the page after it (older)
        name: starting_after
        in: query
      - schema:
          type: string
          description: Object id; returns the page before it (newer)
        required: false
        description: Object id; returns the page before it (newer)
        name: ending_before
        in: query
      - schema:
          anyOf:
          - type: string
          - type: array
            items:
              type: string
          description: 'Relations to embed: partner, referral, link'
        required: false
        description: 'Relations to embed: partner, referral, link'
        name: expand[]
        in: query
      - schema:
          anyOf:
          - type: string
          - type: array
            items:
              type: string
          description: Nothing to include on this resource
        required: false
        description: Nothing to include on this resource
        name: include[]
        in: query
      - schema:
          type: string
        required: false
        name: partner_id
        in: query
      - schema:
          type: string
          enum:
          - lead
          - trial
          - active
          - cancelled
          - refunded
          - suspended
        required: false
        name: status
        in: query
      - schema:
          type: string
        required: false
        name: email
        in: query
      - schema:
          type: string
        required: false
        name: external_customer_id
        in: query
      responses:
        '200':
          description: Customers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerList'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or unknown API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such object in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request was understood and refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited: see Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getV1Customers
      x-operation-id-source: derived
    post:
      tags:
      - Customers
      summary: Create a customer
      description: 'Through a click (`click_id`, the referral''s identity carries over and the partner is whoever owns it) or directly to a partner (`partner_id`, recorded as `tracked_by: api`). Set `external_customer_id` so charges you send later match.


        **Scope:** `commissions:write` (or `write`)'
      security:
      - bearerAuth: []
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerCreate'
      responses:
        '201':
          description: The new customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or unknown API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such object in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request was understood and refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited: see Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: postV1Customers
      x-operation-id-source: derived
    servers:
    - url: https://api.affiliaterail.com
      description: Production
  /v1/customers/{id}:
    get:
      tags:
      - Customers
      summary: Retrieve a customer
      description: '**Scope:** `read`'
      security:
      - bearerAuth: []
      parameters:
      - schema:
          type: string
          pattern: ^(sample_)?cus_
          example: cus_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`cus_…`)
        required: true
        description: Prefixed id (`cus_…`)
        name: id
        in: path
      - schema:
          anyOf:
          - type: string
          - type: array
            items:
              type: string
          description: 'Relations to embed: partner, referral, link'
        required: false
        description: 'Relations to embed: partner, referral, link'
        name: expand[]
        in: query
      - schema:
          anyOf:
          - type: string
          - type: array
            items:
              type: string
          description: Nothing to include on this resource
        required: false
        description: Nothing to include on this resource
        name: include[]
        in: query
      responses:
        '200':
          description: The customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or unknown API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such object in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request was understood and refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited: see Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: getV1CustomersById
      x-operation-id-source: derived
    post:
      tags:
      - Customers
      summary: Update a customer
      description: '`partner_id` reassigns the customer; the change is recorded as manual attribution and shown to both partners.


        **Scope:** `commissions:write` (or `write`)'
      security:
      - bearerAuth: []
      parameters:
      - schema:
          type: string
          pattern: ^(sample_)?cus_
          example: cus_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`cus_…`)
        required: true
        description: Prefixed id (`cus_…`)
        name: id
        in: path
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerUpdate'
      responses:
        '200':
          description: The updated customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or unknown API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such object in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request was understood and refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited: see Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: postV1CustomersById
      x-operation-id-source: derived
    delete:
      tags:
      - Customers
      summary: Delete a customer
      description: 'Refused once the customer has sales: money that moved stays on the ledger.


        **Scope:** `commissions:write` (or `write`)'
      security:
      - bearerAuth: []
      parameters:
      - schema:
          type: string
          pattern: ^(sample_)?cus_
          example: cus_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`cus_…`)
        required: true
        description: Prefixed id (`cus_…`)
        name: id
        in: path
      responses:
        '200':
          description: Deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deleted'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or unknown API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Key lacks the required scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such object in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request was understood and refused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Rate limited: see Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: deleteV1CustomersById
      x-operation-id-source: derived
    servers:
    - url: https://api.affiliaterail.com
      description: Production
components:
  schemas:
    CustomerCreate:
      type: object
      properties:
        program_id:
          type: string
          pattern: ^(sample_)?prg_
          example: prg_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`prg_…`)
        partner_id:
          type: string
          pattern: ^(sample_)?part_
          example: part_7uSyy9FqVLCFWrdPeZaK
          description: Attribute directly to a partner
        click_id:
          type: string
          pattern: ^(sample_)?clk_
          example: clk_7uSyy9FqVLCFWrdPeZaK
          description: Or attribute through the click the visitor arrived on (one of partner_id or click_id is required)
        email:
          type: string
          format: email
        name:
          type: string
        identifier:
          type: string
          description: Your own id for this customer
        external_customer_id:
          type: string
          description: The processor's customer id, used to match incoming charges
        status:
          type: string
          enum:
          - lead
          - trial
          - active
          - cancelled
          - suspended
          default: lead
        metadata:
          type:
          - object
          - 'null'
          additionalProperties: {}
          description: Your own key/value data, stored as given
      required:
      - program_id
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
              - authentication_error
              - permission_error
              - invalid_request_error
              - not_found_error
              - conflict_error
              - rate_limit_error
              - plan_error
              - not_implemented_error
              - api_error
            code:
              type: string
            message:
              type: string
            param:
              type: string
          required:
          - type
          - code
          - message
      required:
      - error
    CustomerList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        has_more:
          type: boolean
          description: Pass the last object's id as `starting_after` to fetch the next page
        total_count:
          type: integer
          description: Count of every object matching the filters, ignoring the cursor
      required:
      - data
      - has_more
      - total_count
    Customer:
      type: object
      properties:
        id:
          type: string
          pattern: ^(sample_)?cus_
          example: cus_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`cus_…`)
        object:
          type: string
          enum:
          - customer
        program_id:
          type: string
          pattern: ^(sample_)?prg_
          example: prg_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`prg_…`)
        partner_id:
          type: string
          pattern: ^(sample_)?part_
          example: part_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`part_…`)
        referral_id:
          type:
          - string
          - 'null'
          pattern: ^(sample_)?ref_
          example: ref_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`ref_…`)
        link_id:
          type:
          - string
          - 'null'
          pattern: ^(sample_)?lnk_
          example: lnk_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`lnk_…`)
        coupon_id:
          type:
          - string
          - 'null'
          pattern: ^(sample_)?cpn_
          example: cpn_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`cpn_…`)
        processor:
          type:
          - string
          - 'null'
          enum:
          - stripe
          - paddle
          - chargebee
          - manual
          - api
          - null
        external_customer_id:
          type:
          - string
          - 'null'
        external_subscription_id:
          type:
          - string
          - 'null'
        email:
          type:
          - string
          - 'null'
        name:
          type:
          - string
          - 'null'
        identifier:
          type:
          - string
          - 'null'
        status:
          type: string
          enum:
          - lead
          - trial
          - active
          - cancelled
          - refunded
          - suspended
        tracked_by:
          type: string
          enum:
          - link
          - coupon
          - manual
          - api
        lead_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2026-08-21T10:15:30.000Z'
          description: ISO-8601, UTC
        converted_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2026-08-21T10:15:30.000Z'
          description: ISO-8601, UTC
        metadata:
          type:
          - object
          - 'null'
          additionalProperties: {}
          description: Your own key/value data, stored as given
        created_at:
          type: string
          format: date-time
          example: '2026-08-21T10:15:30.000Z'
          description: ISO-8601, UTC
        updated_at:
          type: string
          format: date-time
          example: '2026-08-21T10:15:30.000Z'
          description: ISO-8601, UTC
      required:
      - id
      - object
      - program_id
      - partner_id
      - referral_id
      - link_id
      - coupon_id
      - processor
      - external_customer_id
      - external_subscription_id
      - email
      - name
      - identifier
      - status
      - tracked_by
      - lead_at
      - converted_at
      - metadata
      - created_at
      - updated_at
    CustomerUpdate:
      type: object
      properties:
        email:
          type:
          - string
          - 'null'
          format: email
        name:
          type:
          - string
          - 'null'
        identifier:
          type:
          - string
          - 'null'
        status:
          type: string
          enum:
          - lead
          - trial
          - active
          - cancelled
          - suspended
          description: '`refunded` is written by the refund itself'
        partner_id:
          type: string
          pattern: ^(sample_)?part_
          example: part_7uSyy9FqVLCFWrdPeZaK
          description: Reassign; recorded as manual attribution
        metadata:
          type:
          - object
          - 'null'
          additionalProperties: {}
          description: Your own key/value data, stored as given
    Deleted:
      type: object
      properties:
        id:
          type: string
          pattern: ^(sample_)?part_
          example: part_7uSyy9FqVLCFWrdPeZaK
          description: Prefixed id (`part_…`)
        object:
          type: string
        deleted:
          type: boolean
          enum:
          - true
      required:
      - id
      - object
      - deleted
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: rail_live_… or rail_test_…
      description: Create keys in Settings → API keys. Each key carries scopes; the docs name the scope every route needs.
x-refined-from:
- affiliaterail-com-docs-openapi.json
- affiliaterail-com-openapi.json