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

# Invite an affiliate by email

> Idempotent on email — re-inviting an existing affiliate returns the same
record. Mints a unique ref_code variant on collision. New affiliates
land in `pending` for admin approval — unless the program auto-approves
signups, in which case they land in `active` immediately (check the
returned `status`). Requires `write` (or `*`) scope.




## OpenAPI

````yaml /openapi.yaml post /v1/affiliates/invite
openapi: 3.1.0
info:
  title: Affixo API
  version: 1.0.0
  description: |
    The Affixo REST API for affiliate program management and server-to-server
    conversion tracking.

    All requests authenticate with a workspace key (`sa_live_…`) as a Bearer
    token. Scopes: `read` / `write` / `track` / `*`.

    Rate limit: 600 req/min per key (enforced at the edge).
servers:
  - url: https://go.affixo.dev
    description: Production
security: []
tags:
  - name: Affiliates
    description: Manage affiliates (workspace key)
  - name: Campaigns
    description: Create and configure campaigns + commission rules (workspace key)
  - name: Links
    description: Manage referral links (workspace key)
  - name: Risk
    description: AI risk assessments for fraud triage (workspace key)
  - name: Commissions
    description: Approve, deny, and manage commissions (workspace key)
  - name: Conversions
    description: Re-attribute and manage conversions (workspace key)
  - name: Webhooks
    description: Manage webhook endpoint subscriptions (workspace key)
  - name: Reports
    description: Aggregated reporting data (workspace key)
  - name: Resources
    description: Read campaigns, commissions, conversions, payouts (workspace key)
  - name: Tracking
    description: >-
      Server-to-server click & conversion tracking (workspace key, scope
      "track")
paths:
  /v1/affiliates/invite:
    post:
      tags:
        - Affiliates
      summary: Invite an affiliate by email
      description: |
        Idempotent on email — re-inviting an existing affiliate returns the same
        record. Mints a unique ref_code variant on collision. New affiliates
        land in `pending` for admin approval — unless the program auto-approves
        signups, in which case they land in `active` immediately (check the
        returned `status`). Requires `write` (or `*`) scope.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
              properties:
                email:
                  type: string
                  format: email
                name:
                  type: string
                ref_code:
                  type: string
                  description: Preferred referral slug.
      responses:
        '201':
          description: The invited (or pre-existing) affiliate
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    example: affiliate_invite
                  data:
                    type: object
                    properties:
                      affiliate_id:
                        type: string
                        format: uuid
                      ref_code:
                        type: string
                      ref_code_changed:
                        type: boolean
                      email:
                        type: string
                        format: email
                      status:
                        type: string
                        description: >-
                          `active` when the program auto-approves, else
                          `pending`.
                      created:
                        type: boolean
                        description: false when the email already had an affiliate record.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/InsufficientScope'
      security:
        - WorkspaceKey: []
components:
  responses:
    BadRequest:
      description: Invalid or missing parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid_json
    Unauthorized:
      description: Missing or invalid bearer token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unauthorized
    InsufficientScope:
      description: The key lacks the required scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: insufficient_scope
            need: write
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        need:
          type: string
          description: Present on insufficient_scope.
        detail:
          type: string
  securitySchemes:
    WorkspaceKey:
      type: http
      scheme: bearer
      description: 'Workspace API key, e.g. `sa_live_…`. Scopes: read / write / track / *.'

````