> ## 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.

# Set a campaign's sub-affiliate override

> Creates or updates the campaign's single sub-affiliate override: the
commission a recruiting affiliate earns on top of their recruit's own
commission. It does not change the rate affiliates earn on their own
sales (use the commission-rule endpoint for that).

`amount` is a percentage (0 to 100) of the sale's net amount unless
`type` is `flat`. Turns the workspace's sub-affiliates setting on.
Requires the sub-affiliate tiers plan feature (402 otherwise) and
`write` scope. Only affiliates linked to a recruiter earn it.
Configuration only, never moves money.




## OpenAPI

````yaml /openapi.yaml put /v1/campaigns/{id}/sub-affiliate-rule
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/campaigns/{id}/sub-affiliate-rule:
    put:
      tags:
        - Campaigns
      summary: Set a campaign's sub-affiliate override
      description: |
        Creates or updates the campaign's single sub-affiliate override: the
        commission a recruiting affiliate earns on top of their recruit's own
        commission. It does not change the rate affiliates earn on their own
        sales (use the commission-rule endpoint for that).

        `amount` is a percentage (0 to 100) of the sale's net amount unless
        `type` is `flat`. Turns the workspace's sub-affiliates setting on.
        Requires the sub-affiliate tiers plan feature (402 otherwise) and
        `write` scope. Only affiliates linked to a recruiter earn it.
        Configuration only, never moves money.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - amount
              properties:
                amount:
                  type: number
                  exclusiveMinimum: 0
                  description: Percentage (0 to 100), or a flat amount when type=flat.
                type:
                  type: string
                  enum:
                    - percent
                    - flat
                  default: percent
      responses:
        '200':
          $ref: '#/components/responses/SubAffiliateRule'
        '201':
          $ref: '#/components/responses/SubAffiliateRule'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: The plan does not include sub-affiliate tiers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: entitlement_required
                key: sub_affiliate_tiers
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - WorkspaceKey: []
components:
  responses:
    SubAffiliateRule:
      description: The campaign's sub-affiliate override
      content:
        application/json:
          schema:
            type: object
            properties:
              object:
                type: string
                example: sub_affiliate_rule
              campaign:
                type: string
                description: Campaign name.
              data:
                oneOf:
                  - type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      amount:
                        type: number
                      is_flat:
                        type: boolean
                      currency:
                        type:
                          - string
                          - 'null'
                  - type: 'null'
              sub_affiliates_enabled:
                type: boolean
                description: Whether the workspace's sub-affiliates setting is on.
    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
    NotFound:
      description: Resource not found / not in workspace
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: link_not_found
  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 / *.'

````

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