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

# Updates a referral link

> Rename a custom referral link or change its sub_id.



## OpenAPI

````yaml openapi-v2-affiliate-referral-links put /referral_links/{id}
openapi: 3.0.1
info:
  title: FirstPromoter API
  version: '1.0'
  description: API documentation for FirstPromoter affiliate referral links management
servers:
  - url: https://api.firstpromoter.com/api/v2/affiliate
security:
  - BearerAuth: []
paths:
  /referral_links/{id}:
    put:
      summary: Updates a referral link
      operationId: updateReferralLink
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - name: id
          in: path
          description: ID of the referral link to update
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sub_id:
                  type: string
                  description: Sub id
                name:
                  type: string
                  description: Name
      responses:
        '200':
          description: Updated referral link
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferralLink'
        '401':
          description: >-
            Unauthorized — the API key is missing, wrong, regenerated or
            disabled (no JSON response body is returned), or the `Account-ID`
            header is missing.
          content:
            application/json:
              schema:
                type: object
              example: {}
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    AccountId:
      name: Account-ID
      in: header
      required: true
      description: >-
        Account ID of the affiliate program, shown next to your API key under
        Profile → API & AI tools
      schema:
        type: string
        example: acc_123456
  schemas:
    ReferralLink:
      type: object
      properties:
        id:
          type: integer
          nullable: true
        name:
          type: string
        url:
          type: string
        is_default:
          type: boolean
          nullable: true
        source:
          type: string
          enum:
            - campaign
            - promoter
        sub_id:
          type: string
          nullable: true
        campaign:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            color:
              type: string
              nullable: true
    Error:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
      required:
        - message
        - code
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your affiliate API key (Profile → API & AI tools in the affiliate
        dashboard), sent as `Authorization: Bearer {api_key}`

````

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