On this page
couponBatchCodes
query · in the family Reading your records
What it does
One batch’s unique codes with their redemption status — the list you export for a campaign.
One batch's child codes with their redemption status, in mint order, born-paginated (limit defaults 50, clamps 1..100; walk until nextToken is null). The batch must exist in YOUR org group. Requires authentication.
What happens
Read-only.
Who may call it
Capability area: Reading your records — Looking up and listing the records of your organization.
- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- An API key whose scope allows
api:couponBatchCodes
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
batchId | ID ID! | yes | No further notes. |
limit | Int | no | How many records to answer at most; a page may hold fewer. |
nextToken | String | no | The cursor from the previous page, passed back exactly as received. |
Returns
CouponBatchCodePage CouponBatchCodePage! — One page of a batch's child codes (mint order; walk until nextToken is null).
This is a page: items holds the records and nextToken the cursor for the next page — pass it back verbatim until it is null. See paging.
Example request
query ExampleCouponBatchCodes($batchId: ID!, $limit: Int) {
couponBatchCodes(batchId: $batchId, limit: $limit) {
items {
id
code
status
redeemedAt
orderId
}
nextToken
}
}
Variables:
{
"batchId": "01900000-0000-7000-8000-cb95c0160000",
"limit": 1
}
Example response
{
"data": {
"couponBatchCodes": {
"items": [
{
"id": "01900000-0000-7000-8000-37386ae00000",
"code": "BJ-001",
"status": "<status>",
"redeemedAt": "2027-01-31T00:00:00.000Z",
"orderId": "01900000-0000-7000-8000-f6d8263a0000"
}
],
"nextToken": "<the cursor from the previous page>"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": null,
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. (NOT_FOUND)