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

# Update Affiliate

> Updates an affiliate identified by `affiliateId` or `emailAddress`.

This endpoint returns a **count of updated records**, not the affiliate object. Call [Get Affiliate(s)](/api-reference/affiliates/get) afterwards if you need the updated affiliate.

Sending `affiliateLink` **adds another** referral link to the affiliate — it does not rename or replace existing links. Use the [affiliate link endpoints](/api-reference/links/update) to rename or remove a link.



## OpenAPI

````yaml PUT /affiliates
openapi: 3.0.1
info:
  title: Referly API
  description: >-
    REST API for managing affiliates, referrals, sales, affiliate links, coupons
    and promotional codes in your Referly affiliate program.


    Every request must send `Authorization: Bearer <YOUR_API_KEY>`. The token is
    scoped to a single affiliate program, so no program ID is ever required in
    the request — every read and write is automatically limited to that program.


    Requests are rate limited per token, per endpoint and per method.
  version: 1.0.0
servers:
  - url: https://www.referly.so/api/v1
security:
  - bearerAuth: []
paths:
  /affiliates:
    put:
      summary: Update an affiliate
      description: >-
        Updates an affiliate identified by `affiliateId` or `emailAddress`.


        This endpoint returns a **count of updated records**, not the affiliate
        object. Call [Get Affiliate(s)](/api-reference/affiliates/get)
        afterwards if you need the updated affiliate.


        Sending `affiliateLink` **adds another** referral link to the affiliate
        — it does not rename or replace existing links. Use the [affiliate link
        endpoints](/api-reference/links/update) to rename or remove a link.
      requestBody:
        description: Fields to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AffiliateUpdate'
        required: true
      responses:
        '200':
          description: >-
            The number of affiliate records that matched and were updated.
            `count` is `0` when no affiliate in this program matched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateCount'
        '400':
          description: >-
            Neither `affiliateId` nor `emailAddress` was supplied, the requested
            affiliate link is already in use, or the update failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/ProgramNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    AffiliateUpdate:
      type: object
      description: Identify the affiliate with either affiliateId or emailAddress.
      properties:
        affiliateId:
          type: string
          description: The ID of the affiliate (required if emailAddress is not provided)
        emailAddress:
          type: string
          format: email
          description: The email of the affiliate (required if affiliateId is not provided)
        firstName:
          type: string
          description: First name of the affiliate
        lastName:
          type: string
          description: Last name of the affiliate
        email:
          type: string
          format: email
          description: Email of the affiliate
        commissionRate:
          type: number
          format: float
          description: Commission rate for the affiliate
        affiliateStatus:
          type: string
          enum:
            - active
            - inactive
          description: >-
            Set the affiliate active or pending. Any other value falls back to
            the program's auto-approve setting.
        affiliateLink:
          type: string
          description: >-
            Adds an additional referral link with this slug. Existing links are
            kept — this never renames or replaces them. Fails with 400 if the
            slug is already used in this program.
    UpdateCount:
      type: object
      properties:
        count:
          type: integer
          description: How many records matched the filter and were updated
          example: 1
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human readable description of what went wrong
  responses:
    Unauthorized:
      description: >-
        The `Authorization` header is missing, is not a `Bearer` header, or the
        token is not valid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: API access is not enabled for this account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ProgramNotFound:
      description: The affiliate program this token belongs to no longer exists.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Too many requests for this token on this endpoint. Please slow down.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````