approveApprovalRequest
mutation · in the family Approval request
What it does
Grant a pending approval request — your authority unblocks the requester’s act.
Approve a pending ApprovalRequest: the approver's resolved tier rank must be ≥ requiredTier (AUTHZ/INSUFFICIENT) and the approver can never be the requester (AUTHZ/SELF_APPROVAL — strict, no relaxation); a TTL-expired pending refuses CONFLICT/EXPIRED and lazily expires. Requires the unrestricted capability + the record's current revision. On approval the requester retries the identical gated call — the retry consumes the approval by fingerprint.
Before you call
A signed-in user’s session — the call refuses an API key (AUTHZ/FORBIDDEN).
Capability area: Register approvals — Approving or denying the requests raised at a register.
Roles that may call it:
- Owner
- Manager
- Associate Manager
Careful
You are lending your authority to that exact act — the record names you. Never-self-approve holds.
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
id | ID ID! | yes | The id of the record. |
revision | ID ID! | yes | The revision id you read on the record; the change is refused if an edit landed in the meantime. |
reason | String | no |
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
ApprovalRequest ApprovalRequest! — An ApprovalRequest — the real-time, human-approver, in-session authorization of one POS action exceeding the requester's authority (distinct from the async ChangeRequest). The blocked action stays blocked until resolved; short TTL. The request binds a fingerprint (action, targetId[, valueMinor]) + the requester: on approval, retrying the identical gated call finds + consumes the approval by fingerprint. Never self-approve (AUTHZ/SELF_APPROVAL); an under-ranked approver is AUTHZ/INSUFFICIENT.
Example request
mutation ExampleApproveApprovalRequest($id: ID!, $revision: ID!, $reason: String) {
approveApprovalRequest(id: $id, revision: $revision, reason: $reason) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
action
targetType
targetId
valueMinor
requestedBy
requiredTier
reason
expiresAt
decidedBy
decidedAt
decisionReason
}
}Variables:
{
"id": "01900000-0000-7000-8000-e7259dcb0000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"reason": "Correcting a miscount."
}Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"approveApprovalRequest": {
"id": "01900000-0000-7000-8000-e7259dcb0000",
"sysId": "AR-EXMP-0000-000F",
"type": "ApprovalRequest",
"caption": "Blue jeans",
"status": "approved",
"parentId": "01900000-0000-7000-8000-4ed885220000",
"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",
"action": "<action>",
"targetType": "<target type>",
"targetId": "01900000-0000-7000-8000-8b67f1680000",
"valueMinor": 1250,
"requestedBy": "01900000-0000-7000-8000-dae980de0000",
"requiredTier": "owner",
"reason": "Correcting a miscount.",
"expiresAt": "2028-01-31T00:00:00.000Z",
"decidedBy": "01900000-0000-7000-8000-d4d316ba0000",
"decidedAt": "2027-01-31T00:00:00.000Z",
"decisionReason": "<decision reason>"
}
},
"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)