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 group-scoped human-facing system id (CB-…). |
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 FSM state: active | 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 org-group family root. |
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 OCC revision token — supply it on every mutation of this record; rotates on every write. |
refCaptions | RefCaption [RefCaption!]! | The server-composed captions of this record's declared references (the referenced-caption rule) — 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). |