> ## 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 Affiliate Link

> Permanently deletes an affiliate link, identified by either `id` or its `link` slug.

Clicks, referrals and sales already attributed to the link are kept — their link reference is simply cleared. Any referral URL using this slug stops tracking immediately. Fires the `affiliate.updated` webhook for the link's former owner.



## OpenAPI

````yaml DELETE /links
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:
  /links:
    delete:
      summary: Delete affiliate link
      description: >-
        Permanently deletes an affiliate link, identified by either `id` or its
        `link` slug.


        Clicks, referrals and sales already attributed to the link are kept —
        their link reference is simply cleared. Any referral URL using this slug
        stops tracking immediately. Fires the `affiliate.updated` webhook for
        the link's former owner.
      requestBody:
        description: The affiliate link to delete
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AffiliateLinkDelete'
        required: true
      responses:
        '200':
          description: The affiliate link was deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message
                  deletedLink:
                    type: object
                    description: The link that was removed
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The deleted affiliate link ID
                      link:
                        type: string
                        description: The deleted link slug
        '400':
          description: Neither `id` nor `link` was supplied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No affiliate link matched the `id` or `link` supplied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The affiliate link could not be deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AffiliateLinkDelete:
      type: object
      description: Supply either `id` or `link`.
      properties:
        id:
          type: string
          format: uuid
          description: The affiliate link to delete. Required unless `link` is supplied.
        link:
          type: string
          description: The slug of the link to delete. Required unless `id` is supplied.
    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'
    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

````