AlmondTill/G3N API

requestApproval

mutation · in the family Gated floor actions

What it does

Ask a manager to approve something above your limit — a discount, a return, a void.

Mint an ApprovalRequest: ONE transaction — the doc + the (target, action) fingerprint marker (a live-unexpired holder refuses CONFLICT/REFERENCED naming it). requiredTier derives from the canned grants; expiresAt = now + 900s (a touch past it refuses CONFLICT/EXPIRED and lazily expires the request). On approval the requester retries the identical gated call — the retry consumes the approval by fingerprint (single-use). Requires the unrestricted capability.

Before you call

A signed-in user’s session — the call refuses an API key (AUTHZ/FORBIDDEN).

Capability area: Gated floor actions — Voids, returns and the requests that need an approval.

Roles that may call it:

What happens

Files the approval request; the retry of the blocked act consumes the approval once granted.

Arguments

NameTypeRequiredNotes
inputRequestApprovalInput RequestApprovalInput!yesRequest-input for requestApproval: a live gated action + its target + the parent coordinate (tillSessionId XOR logicalFacilityId) + the required reason.

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

graphql
mutation ExampleRequestApproval($input: RequestApprovalInput!) {
  requestApproval(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    action
    targetType
    targetId
    valueMinor
    requestedBy
    requiredTier
    reason
    expiresAt
    decidedBy
    decidedAt
    decisionReason
  }
}

Variables:

json
{
  "input": {
    "action": "<action>",
    "targetId": "01900000-0000-7000-8000-8b67f1680000",
    "valueMinor": 1250,
    "reason": "Correcting a miscount."
  }
}

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

Example response

json
{
  "data": {
    "requestApproval": {
      "id": "01900000-0000-7000-8000-e7259dcb0000",
      "sysId": "AR-EXMP-0000-000F",
      "type": "ApprovalRequest",
      "caption": "Blue jeans",
      "status": "pending",
      "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

Used in