AlmondTill/G3N API

withdrawConsent

mutation · in the family Selling

What it does

Record a customer withdrawing a consent, as staff.

Staff: record a withdraw decision for a named consumer: NO record → dual-birth born withdrawn · granted → the evented transition · already withdrawn → the revision. The same gates + routing verbatim. Template class (classifies with the grant — v20).

Before you call

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

Capability area: Selling — Ringing sales, serving customers and issuing invoices.

Roles that may call it:

What happens

Takes effect immediately; the withdrawal is a permanent ledger fact.

Arguments

NameTypeRequiredNotes
inputConsentDecisionInput ConsentDecisionInput!yesStaff decide-input for grantConsent/withdrawConsent: the acted-on consumer is named and the capture surface is required.

Returns

ConsentRecord ConsentRecord! — A ConsentRecord — the proof-of-decision per (Consumer × Purpose): consumer-parented (parentId = the Consumer id — the LoyaltyMember construct-parented class), family document, sparse. The permanent (consumer × purpose) uniq pair marker is both the singleton guarantee AND the O(1) lookup (never released, never taken over; purge reaps). NO update op — the only writes are the 4 decide ops (grantConsent/withdrawConsent staff · grantMyConsent/withdrawMyConsent consumer) + the system doom; a same-decision re-capture is a capture-context revision under a new policyVersion. Capture context ∈ {policyVersion, captureSurface ∈ [storefront, pos, back_office, cli, import], captureLocale?} reflects the latest decision. Effective consent = resolveEffectiveConsent (the myConsents view): consumer doomed ⇒ denied · purpose inactive/doomed ⇒ denied · granted ⇒ allowed · withdrawn/doomed ⇒ denied · absent ⇒ opt_in? Denied: allowed. Audit rides existing machinery — NO bespoke ledger. NOT searchable.

Example request

graphql
mutation ExampleWithdrawConsent($input: ConsentDecisionInput!) {
  withdrawConsent(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    purposeId
    policyVersion
    captureSurface
    captureLocale
  }
}

Variables:

json
{
  "input": {
    "consumerId": "01900000-0000-7000-8000-3cbb3ce90000",
    "purposeId": "01900000-0000-7000-8000-0faf80a10000",
    "policyVersion": "<policy version>",
    "captureSurface": "<capture surface>",
    "captureLocale": "<capture locale>"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "withdrawConsent": {
      "id": "01900000-0000-7000-8000-c942ced40000",
      "sysId": "CD-EXMP-0000-000F",
      "type": "ConsentRecord",
      "caption": "Blue jeans",
      "status": "granted",
      "parentId": "01900000-0000-7000-8000-3cbb3ce90000",
      "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",
      "purposeId": "01900000-0000-7000-8000-0faf80a10000",
      "policyVersion": "<policy version>",
      "captureSurface": "<capture surface>",
      "captureLocale": "<capture locale>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in