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

# discountCode

> Fetch a single discount configuration by its id. Ids from earlier versions of the Redo API are also accepted.

**Required scopes:** [`campaigns_read`](/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

## Arguments

<ResponseField name="id" type="ID!" required>
  The discount code's `id`, or its `legacyId` from an earlier version of the Redo API.
</ResponseField>

## Returns

<ResponseField name="discountCode" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code">DiscountCode</a>}>
  A discount configuration hosted on Shopify or BigCommerce.

  <Expandable title="fields" lazyRender>
    <ResponseField name="code" type="String!" required>
      The code customers enter at checkout.
    </ResponseField>

    <ResponseField name="createdAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime</a>}>
      When the discount was created.
    </ResponseField>

    <ResponseField name="description" type="String!" required>
      A short human-readable summary of what the code does.
    </ResponseField>

    <ResponseField name="expiration" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-expiration">DiscountCodeExpiration!</a>} required>
      When this code stops working.

      <Expandable title="fields" lazyRender>
        <ResponseField name="date" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime</a>}>
          The expiry instant when `type` is ON\_DATE.
        </ResponseField>

        <ResponseField name="days" type="Int">
          Days after creation when `type` is AFTER\_DAYS.
        </ResponseField>

        <ResponseField name="type" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-expiration-type">DiscountCodeExpirationType!</a>} required>
          Whether the code never expires, expires on a date, after a number of days, or on delivery.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="externalId" type="String!" required>
      The platform's id for this discount (a Shopify GID or a BigCommerce promotion id).
    </ResponseField>

    <ResponseField name="groupType" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-group-type">DiscountCodeGroupType!</a>} required>
      Whether this is one fixed code or a unique code per customer.
    </ResponseField>

    <ResponseField name="id" type="ID!" required>
      The id of this discount code.
    </ResponseField>

    <ResponseField name="kind" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-kind">DiscountCodeKind</a>}>
      How the discount reduces the order. Null when the config has no settings type.
    </ResponseField>

    <ResponseField name="legacyId" type="String!" required>
      The discount's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.
    </ResponseField>

    <ResponseField name="provider" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-provider">DiscountCodeProvider!</a>} required>
      The commerce platform that hosts this code.
    </ResponseField>

    <ResponseField name="settings" type={<a href="/docs/api-reference/v3/reference/marketing/discount-code-settings">DiscountCodeSettings</a>}>
      How the discount reduces the order.
    </ResponseField>

    <ResponseField name="title" type="String!" required>
      The merchant-facing name of the discount.
    </ResponseField>

    <ResponseField name="updatedAt" type={<a href="/docs/api-reference/v3/reference/common/date-time">DateTime</a>}>
      When the discount was last edited.
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

```graphql theme={null}
query {
  discountCode(id: "...") {
    code
    createdAt
    description
    externalId
    groupType
    id
    kind
    legacyId
    # ...
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.