CouponBatch
object type
A CouponBatch: a Coupon-parented batch of unique single-use child codes (the campaign lane). Each child code is a KEY to the parent coupon's terms — the parent's flavor/window/cap/eligibility verdicts run unchanged at attach and the parent's redeem counter counts every use; the child adds exactly ONE law: it redeems once (the stamp rides the place transaction conditioned — a lost race between two carts refuses the second placement). Minted whole in ONE transaction (≤48 codes — the ceiling IS the transaction bound; bigger campaigns mint more batches) via the bespoke createCouponBatch; the codes are server-generated (<prefix>-<random tail> — unguessable, never caller-supplied), take the same org-group code-namespace uniq marker parent codes use, and are listable via couponBatchCodes (campaign codes are distribution artifacts, not secrets). Dooming the batch voids its unredeemed children (attach refuses naming the batch) while redeemed history stands; a clawed-back child (a cancelled order) is redeemable again — the customer's code survives a voided sale.
Fields
| Field | Type | Notes |
|---|---|---|
id | ID ID! | The record’s id — a UUID the platform assigned when the record was created; every reference to this record uses it. |
sysId | String String! | The human-readable id, shaped like CB-… — stable for the record’s life. |
type | String String! | The kind of record — always CouponBatch here. |
caption | String String! | The record’s display name — what people see it called. |
status | String String! | The record’s current state — one of active or doomed. |
parentId | ID ID! | The parent Coupon whose terms every child unlocks — immutable at birth (re-parent = a new batch); parentId!== rootId always. |
rootId | ID ID! | The id of your organization group — every record of yours carries the same one. |
createdAt | String String! | When the record was created, as a UTC timestamp. |
updatedAt | String String! | When the record last changed, as a UTC timestamp. |
revisionNum | Int Int! | How many times this record has been edited; the first save is 0. |
revision | ID ID! | The id of the record’s current edit — send it back with a change so an edit made in the meantime is refused instead of overwritten. |
refCaptions | RefCaption [RefCaption!]! | The captions of the records this one refers to, composed for you — one row per referenced id; see RefCaption. |
codePrefix | String String! | The normalized prefix every child code carries (<prefix>-<tail>) — immutable at birth. |
codeCount | Int Int! | The minted child count (1..48 — the one-transaction bound); immutable (the batch is born whole). |