> ## 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 a Promotional Code

> Permanently deletes a promotional code. Any customer who tries to use it at checkout after this will be rejected. Sales already recorded against the code keep their history.

This cannot be undone — set `active` to `false` with [Update a Promotional Code](/api-reference/promotional-codes/update) if you only want to stop new redemptions. Fires the `promotional_code.deleted` webhook.

## Deleting Promotional Codes

Delete a promotional code from your affiliate program. This removes the code but does not affect the parent coupon or other promotional codes.

<Warning>
  Deleting a promotional code is permanent. Consider deactivating the code
  instead if you want to preserve historical data while preventing future use.
</Warning>


## OpenAPI

````yaml DELETE /promotional-codes
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:
  /promotional-codes:
    delete:
      summary: Delete a promotional code
      description: >-
        Permanently deletes a promotional code. Any customer who tries to use it
        at checkout after this will be rejected. Sales already recorded against
        the code keep their history.


        This cannot be undone — set `active` to `false` with [Update a
        Promotional Code](/api-reference/promotional-codes/update) if you only
        want to stop new redemptions. Fires the `promotional_code.deleted`
        webhook.
      requestBody:
        description: The promotional code to delete
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromotionalCodeDelete'
        required: true
      responses:
        '200':
          description: The promotional code was deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message
                  deletedCode:
                    type: object
                    description: The promotional code that was removed
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: The deleted promotional code ID
                      code:
                        type: string
                        description: The deleted code string
        '400':
          description: '`promotionalCodeId` was not supplied.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No promotional code with that ID exists in this program.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The promotional code could not be deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    PromotionalCodeDelete:
      type: object
      required:
        - promotionalCodeId
      properties:
        promotionalCodeId:
          type: string
          format: uuid
          description: The promotional code ID to delete
    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

````