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

# List Promo Codes

> Retrieves a paginated list of up to 1,000 promo codes for a specific coupon.

<RequestExample>
  ```bash List Promo Codes theme={"system"}
  curl -X GET \
    'https://api.appcharge.com/coupons/coupon/summer26/promo-codes?limit=1000&sortDirection=desc&isActive=true&page=1' \
    -H 'x-publisher-token: <x-publisher-token>'
  ```
</RequestExample>

<ResponseExample>
  ```json List Promo Codes theme={"system"}
  {
      "promoCodes": [
          {
              "name": "swx1",
              "active": false,
              "maxRedemptions": 1,
              "createdAt": "2025-01-22T15:58:24.116Z",
              "updatedAt": "2025-01-22T15:58:24.116Z",
              "redemptions": 100
          },
          {
              "name": "swx2",
              "active": true,
              "maxRedemptions": 1,
              "createdAt": "2025-01-22T15:58:24.116Z",
              "updatedAt": "2025-01-25T08:44:26.668Z",
              "redemptions": 50
          }
      ],
      "totalCount": 2,
      "totalPages": 1,
      "hasNextPage": false,
      "page": 1,
      "limit": 1000
  }
  ```

  ```json 404 theme={"system"}
  {
      "error": "Coupon not found."
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi-coupons.json get /coupons/coupon/{couponName}/promo-codes
openapi: 3.0.3
info:
  title: Coupons API
  version: 1.0.0
servers:
  - url: https://api.appcharge.com
security:
  - PublisherTokenAuth: []
tags:
  - name: Coupons
  - name: Promo Codes
paths:
  /coupons/coupon/{couponName}/promo-codes:
    parameters:
      - in: path
        name: couponName
        required: true
        schema:
          type: string
          example: summer26
        description: Coupon name.
    get:
      tags:
        - Promo Codes
      description: >-
        Retrieves a paginated list of up to 1,000 promo codes for a specific
        coupon.
      parameters:
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            example: 1000
          description: Maximum number of promo codes to return.
        - in: query
          name: page
          required: false
          schema:
            type: integer
            example: 1
          description: Page number to retrieve.
        - in: query
          name: sortDirection
          required: false
          schema:
            type: string
            default: asc
            enum:
              - asc
              - desc
            example: desc
          description: Sort direction of results by `createdAt`.
        - in: query
          name: isActive
          required: false
          schema:
            type: boolean
            example: true
          description: Filter by active status.
      responses:
        '200':
          description: Promo codes retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPromoCodesResponse'
        '404':
          description: Coupon not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                couponNotFound:
                  summary: Coupon not found
                  value:
                    error: Coupon not found.
components:
  schemas:
    ListPromoCodesResponse:
      type: object
      properties:
        promoCodes:
          type: array
          items:
            $ref: '#/components/schemas/PromoCode'
          description: List of promo codes.
        totalCount:
          type: integer
          description: Total number of promo codes matching the query.
          example: 42
        totalPages:
          type: integer
          description: Total number of pages matching the query.
          example: 1
        hasNextPage:
          type: boolean
          description: Whether there is an additional page of results.
          example: true
        page:
          type: integer
          description: Current page number.
          example: 1
        limit:
          type: integer
          description: Maximum number of promo codes per page.
          example: 1000
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong.
    PromoCode:
      type: object
      properties:
        name:
          type: string
          description: Promo code name.
          example: swx1
        active:
          type: boolean
          description: Whether the promo code is active.
          example: true
        maxRedemptions:
          type: integer
          description: Maximum number of times this promo code can be redeemed.
          example: 50
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the promo code was created.
          example: '2025-01-22T15:58:24.116Z'
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the promo code was last updated.
          example: '2025-01-25T08:44:26.668Z'
        redemptions:
          type: integer
          description: Number of times this promo code has been redeemed.
          example: 10
  securitySchemes:
    PublisherTokenAuth:
      type: apiKey
      in: header
      name: x-publisher-token
      description: Publisher token, as displayed in the Publisher Dashboard.

````