AlmondTill/G3N API

updateConsentPurpose

mutation · in the family Consent purpose

What it does

Edit a consent purpose — one named thing customers can allow or refuse (marketing email, data use) — change its details.

Edit a ConsentPurpose's editable fields — an ordinary revision, not a state change; a doomed ConsentPurpose cannot be edited (CONFLICT/IMMUTABLE). Refused while your organization's account is restricted. Send the record's current revision; a stale one is refused (CONFLICT/REVISION_STALE) — read again and retry.

Before you call

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

Capability area: Privacy and compliance — Tax and fiscal configuration, certificates and privacy requests.

Roles that may call it:

Careful

Edits take effect immediately and write a new revision; the old revision stays in history.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
inputEditConsentPurposeInput EditConsentPurposeInput!yesEdit-input for a ConsentPurpose.

Concurrency

Send the record’s current revision from your last read as revision. A stale revision is refused as CONFLICT/REVISION_STALE — read the record again and retry with the new value.

Returns

ConsentPurpose ConsentPurpose! — A ConsentPurpose — the merchant-definable registry of what consent can be requested for. Canned + custom as the role model works: the 6 canned baselines are code-virtual versioned templates (cannedConsentPurposes lists them; copyCannedConsentPurpose materializes an ordinary editable group row — bootstrap materializes zero). Per-channel marketing granularity = distinct purposes (GDPR consent is specific, never bundled). consentModel ∈ {opt_in, opt_out} — opt_in: an absent record ⇒ denied (GDPR) · opt_out: an absent record ⇒ allowed until withdrawn (CCPA Do-Not-Sell) — immutable after birth. The code is the mutable machine handle — unique among non-doomed per group via the consentPurposeCode uniq marker (the organizationCode class: edit = release/reserve swap; doom releases [reissuable]; inactive holds; a collision refuses CONFLICT/IDENTITY_TAKEN). Doom is gated by the everReferenced write-once stamp; deactivate is ungated. NOT searchable (config, not a book); NO description field (captions + decorations do display duty).

Example request

graphql
mutation ExampleUpdateConsentPurpose($id: ID!, $revision: ID!, $input: EditConsentPurposeInput!) {
  updateConsentPurpose(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    code
    consentModel
    templateKey
    templateVersion
    everReferenced
  }
}

Variables:

json
{
  "id": "01900000-0000-7000-8000-82d1f6990000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "caption": "Blue jeans"
  }
}

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

Example response

json
{
  "data": {
    "updateConsentPurpose": {
      "id": "01900000-0000-7000-8000-82d1f6990000",
      "sysId": "PP-EXMP-0000-000F",
      "type": "ConsentPurpose",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "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",
      "code": "BJ-001",
      "consentModel": "<consent model>",
      "templateKey": "<template key>",
      "templateVersion": 1,
      "everReferenced": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.