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:
- Owner
- Manager
- Associate Manager
- Sales Associate
- Cashier
- An API key whose scope allows
api:withdrawConsent
What happens
Takes effect immediately; the withdrawal is a permanent ledger fact.
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
input | ConsentDecisionInput ConsentDecisionInput! | yes | Staff 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
mutation ExampleWithdrawConsent($input: ConsentDecisionInput!) {
withdrawConsent(input: $input) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
purposeId
policyVersion
captureSurface
captureLocale
}
}Variables:
{
"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
{
"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
VALIDATION/INVALID— Something in the request is not valid. Retry: no. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. Retry: no. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. Retry: no. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. Retry: yes. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. Retry: no. (NOT_FOUND)CONFLICT/*— The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. (CONFLICT)VALIDATION/VERSION_REQUIRED— The request did not say which app version it came from. Retry: no. (VALIDATION)