AlmondTill/G3N API

On this page

couponBatch

query · in the family Coupon batch

What it does

Look up one batch of unique coupon codes.

A CouponBatch by id, within the caller's OWN org-group family; requires authentication. A cross-tenant id reads as null (not-found) AND trips the rootId tripwire server-side.

What happens

Read-only.

Who may call it

Capability area: Reading your records — Looking up and listing the records of your organization.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.

Returns

CouponBatch — 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.

Example request

query ExampleCouponBatch($id: ID!) {
  couponBatch(id: $id) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    codePrefix
    codeCount
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000"
}

Example response

{
  "data": {
    "couponBatch": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "CB-EXMP-0000-000F",
      "type": "CouponBatch",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "codePrefix": "<code prefix>",
      "codeCount": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer