AlmondTill/G3N API

couponBatch

query · in the family Coupon batch

What it does

Look up one batch of unique coupon codes.

One CouponBatch by id. The record must belong to your organization group; an id from another group reads as not found.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

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

Roles that may call it:

What happens

Read-only.

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

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

Variables:

json
{
  "id": "01900000-0000-7000-8000-fc56cc5d0000"
}

Example response

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

Errors this call can answer