# DiscountCodesList

> List discount codes with filter, sort and offset paging: code, value, status, usage and tags. Read access, discounts toolset, MCP tool list_discount_codes.

**Access:** [Read](https://developer.missin.co.uk/get-started/authentication.md#access-levels)

## Variables

| Variable | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `filter` | `DiscountCodeFilter` | no | [DiscountCodeFilter](https://developer.missin.co.uk/reference/input-types.md#discountcodefilter) |  |
| `first` | `Int!` | yes | 32-bit integer. MCP tools send `50` when it is left out |  |
| `offset` | `Int` | no | 32-bit integer. Default `0` | Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`. |
| `orderBy` | `[DiscountCodeOrderBy!]` | no | One of 33 values, see [DiscountCodeOrderBy](https://developer.missin.co.uk/reference/input-types.md#discountcodeorderby). Default `["CREATED_AT_DESC"]` | The method to use when ordering `DiscountCode`. |
| `withTotal` | `Boolean!` | yes | MCP tools send `false` when it is left out | Included when true. |

## Call it

```bash curl
curl https://api.missin.co.uk/graphql/v1 \
  -H "Authorization: Bearer $MISSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operationName":"DiscountCodesList","variables":{"first":50,"withTotal":false},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"0dfdd8bbd62996fbdb7bbf0ff2957549620b81c4a1d5231cb0d55c196d9cd947"}}}'
```

## Document

```graphql
fragment DiscountCodeListRow on DiscountCode { __typename code createdAt createdBy displayName endsAt id isPublic partnerByPartnerId { __typename id rowId } publicTier rowId startAt status tags title updatedAt usageCount usageLimit usageSource valueAmount valuePercent version } query DiscountCodesList($filter: DiscountCodeFilter, $first: Int!, $offset: Int = 0, $orderBy: [DiscountCodeOrderBy!] = [CREATED_AT_DESC], $withTotal: Boolean!) { __typename allDiscountCodes( filter: $filter orderBy: $orderBy first: $first offset: $offset ) { __typename nodes { __typename ...DiscountCodeListRow } totalCount @include(if: $withTotal) } }
```

Source: https://developer.missin.co.uk/reference/discounts/discount-codes-list
