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

# List Promotion Codes

> Returns the codes for a promotion's active pool

<Info>
  Scope required: `promos.read`
</Info>

This endpoint returns the codes belonging to a promotion's active code pool,
ordered oldest first. The promotion must belong to the specified merchant and
be in the `active` state, otherwise a `404 Not Found` is returned.

If the promotion has no active pool, an empty `codes` array is returned with
zero total pages.

To pull codes to hand out to customers, filter by `status=unredeemed`. Note
that a code stays `unredeemed` until the customer redeems it at the point of
sale — not when you send it — so you must track which codes you have already
dispensed on your side. See
[Dispensing codes to customers](/partner/promotions/overview#dispensing-codes-to-customers).

### Parameters

<ParamField path="id" type="string" required>
  Promotion ID
</ParamField>

<ParamField query="merchant_id" type="string" required>
  Merchant ID
</ParamField>

<ParamField query="status" type="string" optional>
  Filter by redemption status: `unredeemed` or `redeemed`. Omit to return all
  codes.
</ParamField>

<ParamField query="page" type="integer" optional>
  The current page of paginated codes.

  * Default: `1`
</ParamField>

<ParamField query="per_page" type="integer" optional>
  Number of codes to return per request.

  * Default: `500`
  * Minimum: `1`
  * Maximum: `10000`
</ParamField>

### Response

<ResponseField name="code" type="string">
  The promotion code
</ResponseField>

<ResponseField name="status" type="string">
  Redemption status: `redeemed` if the code has been redeemed at least once,
  otherwise `unredeemed`
</ResponseField>

<Snippet file="pagination/response.mdx" />

<RequestExample>
  ```bash List Promotion Codes theme={null}
  curl 'https://api.thanxsandbox.com/partner/promotions/promo_abc123/codes?merchant_id={merchant_id}&status=unredeemed&per_page=500' \
    -X GET \
    -H 'X-ClientId: {client_id}' \
    -H 'Accept-Version: v4.0' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {access_token}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example theme={null}
  {
    "codes": [
      {
        "code": "A1B2C3D4",
        "status": "unredeemed"
      },
      {
        "code": "7QMX9K2P",
        "status": "redeemed"
      }
    ],
    "pagination": {
      "current_page": 1,
      "per_page": 500,
      "total_pages": 20
    }
  }
  ```
</ResponseExample>
