> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dezerx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get an affiliate

> One affiliate with a balance breakdown.

**Permission:** `modules.affiliates.affiliates.read`



## OpenAPI

````yaml /docs/modules-api.yaml get /application/modules/affiliates/affiliates/{affiliate}
openapi: 3.1.0
info:
  title: Spartan Module API
  version: '2026.11'
  description: >-
    Endpoints added by modules. Key endpoints live under
    `/api/application/modules/<module>/` and need an API key with the module
    permission. Content modules (Blog, News, Knowledge Base, Status) also offer
    keyless read only endpoints under `/api/public/modules/<module>/` that only
    return what an anonymous visitor can see.
servers:
  - url: https://{domain}/api
    description: Your Spartan installation
    variables:
      domain:
        default: billing.example.com
        description: Domain of your Spartan installation, without https://
security:
  - bearerAuth: []
tags:
  - name: Blog
  - name: Blog (public)
  - name: News
  - name: News (public)
  - name: Knowledge Base
  - name: Knowledge Base (public)
  - name: Status
  - name: Status (public)
  - name: Forms
  - name: Affiliates
  - name: Deprecated endpoints
paths:
  /application/modules/affiliates/affiliates/{affiliate}:
    get:
      tags:
        - Affiliates
      summary: Get an affiliate
      description: |-
        One affiliate with a balance breakdown.

        **Permission:** `modules.affiliates.affiliates.read`
      operationId: getAffiliate
      parameters:
        - name: affiliate
          in: path
          required: true
          description: Affiliate id.
          schema:
            type: integer
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Affiliate'
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - data
                  - meta
              example:
                data:
                  id: 43
                  user:
                    id: 27
                    name: Priya Nair
                    email: priya.nair@example.com
                  code: EA763350
                  status: approved
                  is_active: true
                  enrolled: true
                  referrer_affiliate_id: null
                  total_earnings: 0
                  available_balance: 0
                  paid_earnings: 0
                  balance_owed: 0
                  referrals_count: 0
                  converted_referrals_count: 0
                  total_clicks: 0
                  unique_clicks: 0
                  enrolled_at: '2026-09-04T11:52:00Z'
                  approved_at: '2026-09-04T11:52:00Z'
                  last_activity: '2026-09-04T11:52:00Z'
                  created_at: '2026-09-04T11:52:00Z'
                  updated_at: '2026-09-04T11:52:00Z'
                  balance:
                    lifetime_earnings: 0
                    available_balance: 0
                    maturing_earnings: 0
                    pending_review: 0
                    paid_earnings: 0
                    reserved_for_payouts: 0
                    balance_owed: 0
                meta:
                  request_id: 603dc304-27a3-42f6-8e48-af8c2c80c59d
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_found:
                  summary: Unknown affiliate
                  value:
                    error:
                      code: not_found
                      message: Affiliate not found.
                      details: {}
                    request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
components:
  schemas:
    Affiliate:
      type: object
      properties:
        id:
          type: integer
          description: Affiliate id.
        user:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            name:
              type: string
            email:
              type: string
        code:
          type: string
          description: Referral code.
        status:
          type: string
          enum:
            - pending
            - approved
            - rejected
        is_active:
          type: boolean
        enrolled:
          type: boolean
        referrer_affiliate_id:
          type:
            - integer
            - 'null'
          description: Affiliate that referred this affiliate.
        total_earnings:
          type: number
        available_balance:
          type: number
        paid_earnings:
          type: number
        balance_owed:
          type: number
        referrals_count:
          type: integer
        converted_referrals_count:
          type: integer
        total_clicks:
          type: integer
        unique_clicks:
          type: integer
        enrolled_at:
          type:
            - string
            - 'null'
          format: date-time
        approved_at:
          type:
            - string
            - 'null'
          format: date-time
        last_activity:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        balance:
          type: object
          properties:
            lifetime_earnings:
              type: number
            available_balance:
              type: number
            maturing_earnings:
              type: number
            pending_review:
              type: number
            paid_earnings:
              type: number
            reserved_for_payouts:
              type: number
            balance_owed:
              type: number
          description: >-
            Single affiliate responses only. Balance breakdown from the
            affiliate ledger.
    Meta:
      type: object
      properties:
        request_id:
          type: string
          format: uuid
          description: Request id, also sent in the `X-Request-ID` response header.
      required:
        - request_id
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Machine readable error code, for example `unauthorized`,
                `forbidden`, `not_found`, `invalid_service_state`.
            message:
              type: string
              description: Human readable explanation.
            details:
              type: object
              properties: {}
              description: Extra context. An empty object for most errors.
              additionalProperties: true
          required:
            - code
            - message
            - details
        request_id:
          type: string
          format: uuid
          description: >-
            Request id. Also returned in the `X-Request-ID` header. Send your
            own with `X-Request-ID` to correlate logs.
      description: Error envelope returned by every failed request.
      required:
        - error
        - request_id
  responses:
    Unauthorized:
      description: Missing, invalid or inactive API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing:
              summary: No Authorization header
              value:
                error:
                  code: unauthorized
                  message: Bearer token required.
                  details: {}
                request_id: 9aca26ca-e06f-4725-8e4b-4385d6c03422
            invalid:
              summary: Unknown or inactive key
              value:
                error:
                  code: unauthorized
                  message: Invalid or inactive token.
                  details: {}
                request_id: 8802a669-6f06-453e-a1d8-0b81621167c3
    Forbidden:
      description: >-
        The key lacks the permission for this endpoint, or the request IP is not
        in the key allow list.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Missing permission
              value:
                error:
                  code: forbidden
                  message: Insufficient permissions for this action.
                  details: {}
                request_id: 6bf04242-ac61-44b9-9dbf-b63a114b54c8
            ip_not_allowed:
              summary: IP not allowed
              value:
                error:
                  code: ip_not_allowed
                  message: Access denied from this IP address.
                  details: {}
                request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key created in Admin, API. Send it as `Authorization: Bearer <key>`.
        Each key has its own permissions and optional IP allow list.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.