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

# Delete Affiliates

> Permanently deletes an affiliate from the program, along with the records that cascade from them (their affiliate links, referrals, sales and commissions). This cannot be undone.

`affiliateId` accepts either the affiliate's UUID or their email address. The request succeeds with the same response even when nothing matched, so check the affiliate exists first if that matters to you. Fires the `affiliate.deleted` webhook.



## OpenAPI

````yaml DELETE /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:
    delete:
      summary: Delete affiliates
      description: >-
        Permanently deletes an affiliate from the program, along with the
        records that cascade from them (their affiliate links, referrals, sales
        and commissions). This cannot be undone.


        `affiliateId` accepts either the affiliate's UUID or their email
        address. The request succeeds with the same response even when nothing
        matched, so check the affiliate exists first if that matters to you.
        Fires the `affiliate.deleted` webhook.
      requestBody:
        description: The affiliate to delete
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AffiliateDelete'
        required: true
      responses:
        '200':
          description: The affiliate was deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteMessage'
        '400':
          description: '`affiliateId` was not supplied, or the delete 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:
    AffiliateDelete:
      type: object
      required:
        - affiliateId
      properties:
        affiliateId:
          type: string
          description: >-
            The ID of the affiliate to delete. An affiliate email address is
            also accepted.
    DeleteMessage:
      type: object
      properties:
        message:
          type: string
          description: Confirmation message
    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

````