> ## 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.

# GeneratedDiscountCode

> A unique code generated from a discount configuration for one customer or send.

**Required scopes:** [`campaigns_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

**code** `String!` *required*

The code a customer enters at checkout.

**createdAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the code was generated.

**customer** `[Customer](/docs/api-reference/v3/reference/customers/customer)`

The customer the code was generated for. Null when it was not generated for a customer, or the customer has since been deleted.

**Requires:** [`customers_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-customers_read)

**fields**

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the customer record was created.

**customFields** `[JSON](/docs/api-reference/v3/reference/common/json)`

Merchant-defined custom field values, keyed by each field's name. Null when the customer has no custom fields set.

**email** `String`

The customer's primary email address.

**firstName** `String`

The customer's first name.

**id** `ID!` *required*

The id of this customer.

**lastName** `String`

The customer's last name.

**legacyId** `String!` *required*

The customer's legacy identifier (the source Mongo ObjectId), accepted anywhere an `id` is.

**location** `[CustomerLocation](/docs/api-reference/v3/reference/customers/customer-location)`

The customer's current location, if known.

**fields**

**city** `String`

The city, town, or village.

**country** `String`

The country name.

**countryCode** `String`

The country code.

**ianaTimeZoneName** `String`

The IANA time zone name for the location (e.g. America/New\_York).

**latitude** `Float`

The latitude of the location, if geocoded.

**longitude** `Float`

The longitude of the location, if geocoded.

**postalCode** `String`

The postal or ZIP code.

**state** `String`

The state, province, or region name.

**stateCode** `String`

The state, province, or region code.

**street1** `String`

The first line of the street address.

**street2** `String`

The second line of the street address.

**phoneNumber** `String`

The customer's primary phone number.

**supportTickets** `[SupportTicketConnection!](/docs/api-reference/v3/pagination)` *required*

The help desk tickets this customer is the primary contact on any thread of, newest first. Every ticket whose `customer` is this customer is here.

**Requires:** [`support_tickets_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-support_tickets_read)

**fields**

**Arguments**

**after** `String`

Forward pagination cursor — returns tickets after it.

**before** `String`

Backward pagination cursor — returns tickets before it.

**first** `Int`

Forward pagination: returns the first N tickets (max 100, default 25). Use with `after`; mutually exclusive with `last`/`before`.

**last** `Int`

Backward pagination: returns the last N tickets (max 100, default 25). Use with `before`; mutually exclusive with `first`/`after`.

**Fields**

**edges** `[\[SupportTicketEdge!\]!](/docs/api-reference/v3/pagination)` *required*

The list of edges (each a node plus its pagination `cursor`).

**nodes** `[\[SupportTicket!\]!](/docs/api-reference/v3/reference/support/support-ticket)` *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** `[PageInfo!](/docs/api-reference/v3/pagination)` *required*

Pagination metadata for the current page.

**tags** `[CustomerTagConnection!](/docs/api-reference/v3/pagination)` *required*

The tags on this customer, from the store's customer tag catalog, A–Z by name.

**Requires:** [`customers_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-customers_read)

**fields**

**Arguments**

**after** `String`

Forward pagination cursor — returns tags after it.

**before** `String`

Backward pagination cursor — returns tags before it.

**first** `Int`

Forward pagination: returns the first N tags (max 100, default 25). Use with `after`; mutually exclusive with `last`/`before`.

**last** `Int`

Backward pagination: returns the last N tags (max 100, default 25). Use with `before`; mutually exclusive with `first`/`after`.

**Fields**

**edges** `[\[CustomerTagEdge!\]!](/docs/api-reference/v3/pagination)` *required*

The list of edges (each a node plus its pagination `cursor`).

**nodes** `[\[CustomerTag!\]!](/docs/api-reference/v3/reference/marketing/customer-tag)` *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** `[PageInfo!](/docs/api-reference/v3/pagination)` *required*

Pagination metadata for the current page.

**updatedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the customer record was last updated.

**expiresAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the code stops working. Null if it never expires.

**id** `ID!` *required*

The id of this generated discount code.

**lastUsedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the code was last used. Null if it never was.

**legacyId** `String!` *required*

The generated code's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.

**source** `[GeneratedDiscountCodeSource!](/docs/api-reference/v3/reference/marketing/generated-discount-code-source)` *required*

Which Redo feature generated the code.

**status** `[GeneratedDiscountCodeStatus!](/docs/api-reference/v3/reference/marketing/generated-discount-code-status)` *required*

Whether the code is active, expired, or a preview. Usage does not change it: see `usageCount`.

**usageCount** `Int!` *required*

How many times the code was used on an order. A code used before usage records were kept counts as 1.


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