ObjectStackObjectStack

Approval chains — multi-step sign-off rules

Route a record for sign-off with an approval flow — who may configure it, and the run-identity choice that keeps it from bypassing row-level security.

Scenario

A record (an invoice, a discount, a leave request) must be routed for approval before it proceeds. Who is allowed to build that automation, and how do I make sure it runs safely?

An approval is a flow with an approval node. Two access decisions matter as much as the routing itself.

1. Who can configure it

Authoring flows/automations is a builder capability — it needs manage_metadata (typically Studio users). End users submit records and act on approval requests, but they do not edit the automation. Keep the automation surfaces out of consumer apps (see audience-based interfaces).

2. As whom does it run — the safety decision

A flow declares runAs (ADR-0049), and for approvals this is the decision that keeps it safe:

  • runAs: 'user' (default) — the flow's data operations run as the submitter, respecting their RLS. Good when the flow only touches records the submitter can already see.
  • runAs: 'system' — elevated, bypasses RLS. Needed when the flow must read/write records the submitter can't (e.g. post to a ledger, notify an approver who owns rows the submitter can't see). Declare it explicitly so the elevation is visible, not accidental.

A run that resolves no triggering user has nothing to scope to, so under the default runAs: 'user' its data operations are refused — declare system to make the elevation explicit and intended. os lint rejects the shapes it can prove at authoring time (flow-runas-unscoped, covering schedule / time-relative / api triggers), and the engine warns at run setup before refusing.

This is not a schedule-only concern, and for approvals it is the common case: the approvals service mirrors a decision back onto the target record with a system write, which carries no user. Any record-change flow bound to that object then runs with no triggering user — so a flow left at the default runAs: 'user' is refused. Nothing can flag that at authoring time (whether a given write carries a user is only knowable at run time), so declare runAs: 'system' on record-change flows that react to approval outcomes.

3. The approval node

The node declares who approves (a named user, a position, the submitter's manager, …) and what happens on approve / reject / escalate. Not every kind is configured the same way: the submitter's manager resolves from a column a platform admin sets on the user (Setup → Users → ⋯ → Set Manager), not on the node, so read the manager callout below before you reach for it. The authoritative shape is ApprovalNodeConfig / ApproverType; a flow strings the trigger, the approval node, and the post-decision branches together.

// Illustrative — see the Approval reference for the exact node schema.
defineFlow({
  name: 'invoice_approval',
  type: 'record_change',
  runAs: 'user',                       // submitter's RLS unless a step needs more
  nodes: [
    { id: 'start', type: 'start', label: 'Start',
      config: { objectName: 'invoice', triggerType: 'record-after-create' } },
    { id: 'approval', type: 'approval', label: 'Approval',
      config: { approvers: [{ type: 'position', value: 'finance_manager' }] } },
    { id: 'mark_approved', type: 'update_record', label: 'Mark Approved' },
    { id: 'mark_rejected', type: 'update_record', label: 'Mark Rejected' },
  ],
  edges: [
    { id: 'e1', source: 'start', target: 'approval' },
    { id: 'e2', source: 'approval', target: 'mark_approved', label: 'approve' },
    { id: 'e3', source: 'approval', target: 'mark_rejected', label: 'reject' },
  ],
});

position vs org_membership_level. { type: 'position', value: 'finance_manager' } routes to the holders of a position (sys_user_position, ADR-0090 D3). org_membership_level is a different thing — the better-auth org-membership tier, whose only values are owner/admin/member. A position name authored there matches nobody, so that approver adds no one to the request, and a slate left naming no one goes to the node's onEmptyApprovers; os lint flags it (approval-approver-not-membership-tier).

Authored type: 'role' on 15.x? That is the deprecated spelling of org_membership_level (ADR-0090 D3): it still resolves, warns at runtime, and is removed in the next major. It resolves exactly as org_membership_level does, so a position name authored there finds no member and leaves the org_membership_level:<value> slot, which only an admin override can decide. The fix is one line: { type: 'position', value: '<the position>' }.

manager is set on the user by an admin, not configured here. { type: 'manager' } resolves at runtime from sys_user.manager_id on the record's owner. That column is not a profile field: it is readonly on the user form and the data API's managed-update whitelist is {name, image, locale}, so it is never populated by editing the user in the Console.

It has a dedicated admin operation instead. In the Console a platform admin sets it from Setup → Users → ⋯ → Set Manager (the user's row menu, or the user record's header), which posts the link to the endpoint below; a script can post it directly:

POST /api/v1/auth/admin/set-user-manager
Content-Type: application/json

{ "userId": "usr_report", "managerId": "usr_boss" }

"managerId": null clears the link. The endpoint refuses a link that would make a user their own manager, close a cycle in the reporting chain, run past the chain depth cap, or point at a manager who is provably outside every organization the user belongs to — each with the reason in the response. It is platform-admin gated, like every other /api/v1/auth/admin/* route.

For many users at once, the admin bulk import (POST /api/v1/auth/admin/import-users) reads a manager_id column holding the manager's email address (or phone number, where phone sign-in is enabled) — someone in the same file or an existing user. It links each row once every row in the file exists, through the same refusals as the endpoint above, and reports each outcome on the row's manager result: a link it cannot make never fails the user it imported.

The column is also written by a seed, or by any other system-context write, which bypasses the managed-update whitelist. SCIM provisioning populates it too: the Enterprise User manager attribute, whose value is the manager's SCIM resource id, is written onto the column on a SCIM create, replace or patch that names the attribute, through the same refusals (each answered as a SCIM 400 invalidValue). It is written only for an active user the directory holds, and only from the connection that provisioned that user's profile. A write that does not name the attribute leaves the column as it is; removing the attribute, or a replace without it, clears the column. An id that names no existing user the connection provisioned does not fail the write: the user is saved, the column stays as it was, and the server logs a warning for the operator and records a scim_manager_unresolved row in the audit log, naming the connection, the user and the reference, once per connection per ten minutes. Where a SCIM directory holds an identity (it carries source: 'idp_provisioned' and the directory has provisioned or linked it) the admin operation refuses, the import's manager_id column included, so that directory stays the one surface that authors its manager. Any other directory sync writes it only through a path your own deployment supplies. A person who only signs in through SSO also carries source: 'idp_provisioned', but no directory holds them: their manager is set with Set Manager or the import like anyone else's.

Setting the column is still something you have to do. Where manager_id is unset the rung expands to nobody, and under the default onEmptyApprovers: 'admin_rescue' the request opens on the organization's administrators instead of on the submitter's manager (When a slate names no one). So set it for everyone who submits this request, or take one of the two escapes that need no write to the column at all: add a second approver entry that cannot resolve empty — e.g. { type: 'org_membership_level', value: 'owner' } — or declare onEmptyApprovers: 'fallback' on the node with a fallbackApprovers list, so an empty manager rung opens the request on those people instead of on the administrators. Neither makes manager resolve; they route the request to the person who should decide it, which is a different and independently useful thing. os lint reports the shape at authoring time (approval-approvers-may-resolve-empty, info) and carries the same remedy text, so the two cannot drift apart — and it keeps reporting it even with a fallback declared, because a static check cannot read the column and cannot know the fallback resolves either.

Approving is itself a gated action — model "may approve" as a capability (approve_invoice) the approver's permission set grants, and gate the approve action's requiredPermissions on it so the gate is enforced on both the UI and the server (ADR-0066 D4).

Approval nodes in practice

Approvals are authored as Flow nodes with type: 'approval'. The @objectstack/plugin-approvals package owns the durable approval state (sys_approval_request and sys_approval_action), record locking, approver resolution, and resume-on-decision behavior.

export const opportunityApproval: Flow = {
  name: 'opportunity_approval',
  label: 'Opportunity Approval',
  type: 'record_change',
  status: 'active',
  nodes: [
    {
      id: 'start',
      type: 'start',
      label: 'Start',
      config: {
        triggerType: 'record-after-update',
        objectName: 'opportunity',
        condition: "record.amount != null && record.amount >= 50000 && record.stage == 'proposal'",
      },
    },
    {
      id: 'manager_approval',
      type: 'approval',
      label: 'Manager Approval',
      config: {
        approvers: [{ type: 'field', value: 'owner_manager_id' }],
        behavior: 'unanimous',
        approvalStatusField: 'approval_status',
        lockRecord: true,
      },
    },
    { id: 'mark_approved', type: 'update_record', label: 'Mark Approved' },
    { id: 'mark_rejected', type: 'update_record', label: 'Mark Rejected' },
    { id: 'end', type: 'end', label: 'End' },
  ],
  edges: [
    { id: 'e1', source: 'start', target: 'manager_approval' },
    { id: 'approved', source: 'manager_approval', target: 'mark_approved', label: 'approve' },
    { id: 'rejected', source: 'manager_approval', target: 'mark_rejected', label: 'reject' },
    { id: 'e4', source: 'mark_approved', target: 'end' },
    { id: 'e5', source: 'mark_rejected', target: 'end' },
  ],
};

For multi-step approvals, chain multiple approval nodes. For parallel approvals, see the aggregating-node pattern in Flow Metadata.

Combining multiple approvers (#3266)

When a node has several approvers, behavior decides what "approved" means — one node, no parallel branches needed:

behaviorAdvances when…Use for
first_response (default)any one approvessingle reviewer / "any manager"
unanimousevery resolved approver approvessmall fixed panels
quorumminApprovals of N approve (M-of-N)"2 of 3 directors"
per_groupeach group reaches minApprovals (default 1)"legal and finance" sign-off (会签)
// One legal AND one finance approver must sign off; either rejection vetoes.
{ type: 'approval', config: {
    approvers: [
      { type: 'position', value: 'legal_counsel', group: 'legal' },
      { type: 'position', value: 'controller',    group: 'finance' },
    ],
    behavior: 'per_group',   // or 'quorum' with minApprovals: 2
} }

A single rejection always finalizes the node as rejected (one veto), in every mode. minApprovals is clamped to the resolvable approver count / group size, so it can never deadlock. A decision may also carry attachments (file references) recorded on its audit row — e.g. a signed contract — and, when the node declares decisionOutputs, structured outputs the flow receives as <nodeId>.<key> variables (see Dynamic approvers below). Weighted voting and approval-matrix governance are enterprise, not here.

Dynamic approvers (#3447)

Two approver kinds bind to live data at the moment the node is entered — not the submit-time snapshot — so a step can route on data produced after submit:

  • field reads the record's live field value at node entry. An earlier step (or an earlier step's approver) can write the routing field mid-flow and the next approval node sees it; a multi-select user field fans out into one approver slot per user.
  • expression computes the slate with a CEL expression over exactly three roots: current.* (the record's live state at node entry), trigger.* (the submit-time snapshot — what a flow condition calls record), and vars.* (flow variables, including node outputs and vars.previous). record and bare field names are deliberately unavailable — at an approval node "the record" is ambiguous between two times, so the expression must say which one; referencing anything else fails the node loudly at entry rather than resolving a silently-empty slate. The optional resolveAs: 'user' (default) | 'department' | 'position' | 'team' re-expands each resolved id through the same graph lookups the static types use — and with behavior: 'per_group', each intermediate value (e.g. each returned department) forms its own sign-off group.

Approving across organizations (ADR-0105 D9)

Requires the group tenancy posture. Under single or isolated the runtime refuses an approver that declares organization, rather than ignoring it.

A group-shaped deployment routinely needs a plant's document signed off by someone at the group: the purchase order lives in the plant organization, but the CFO holds her cfo position in the group organization. By default an approver is resolved against the request's own organization, so cfo would match nobody there.

Declare which organization's directory resolves that approver:

config: {
  approvers: [
    { type: 'position', value: 'plant_manager', group: 'plant' },
    { type: 'position', value: 'cfo', organization: '$root', group: 'finance' },
  ],
  behavior: 'per_group',   // one plant sign-off AND one group sign-off
}

organization takes a symbol or an organization slug:

ValueResolves to
$rootthe group organization — climbs parent_organization_id to the top
$parentexactly one level up (division sign-off in a three-tier group)
a slug, e.g. acme-sscthat organization — for a sibling, such as a shared-services centre approving payables for every plant

Prefer the symbols. Flow metadata is portable across environments while organization ids are minted per deployment, so $root says "the group" without naming anything deployment-specific. An organization id is rejected: pass the slug.

Three things this deliberately does not do:

  • It does not move the request. Only the approver lookup changes — the request, its audit trail, and its inbox rows stay in the plant's organization.
  • It is not a route to any tenant. The target must share a parent_organization_id root with the request's organization, so approval routes within one group. The rule reads only the organization tree, never the submitter, so a flow routes identically for everyone.
  • It does not apply to every approver kind. user, field, manager and team name people without consulting an organization directory; organization on those is refused at runtime and flagged by os lint (approval-approver-cross-org-unsupported).

A cross-organization approver must also be able to read the request. The request stays in the plant's organization, so a group-side approver reaches it only if she also holds a membership there — the usual group shape is that group staff are members of every plant while holding their positions at the group. Approvers without that membership are dropped from the slate with a warning naming them, and the node's onEmptyApprovers policy takes over — better an empty slate you can see than a task the tenancy wall hides.

A result may legitimately be empty (a present-but-empty field or variable); the node-level onEmptyApprovers policy decides what that means — admin_rescue (default: the request opens on the organization's administrators — When a slate names no one), fail (the node fails: an empty slate is a config bug), auto_approve (skip the request and continue down approve with output.autoApproved = true; opt-in, since it waves the record through), or fallback (open the request on the people named in fallbackApprovers). A missing key (vars.never_written) is a loud error instead — guard genuinely-optional inputs with has(vars.x) ? vars.x : [].

fallback is how a node names who decides an empty slate, instead of leaving it to the organization's administrators:

{
  approvers: [{ type: 'manager' }],
  onEmptyApprovers: 'fallback',
  fallbackApprovers: [{ type: 'org_membership_level', value: 'owner' }],
}

fallbackApprovers takes the same entries as approvers — same types, same group / resolveAs / organization keys — and is resolved by the same expansion, OOO delegation included. The pairing is enforced in both directions: fallback without a fallbackApprovers list is refused, and a fallbackApprovers list under any other policy is refused too, because nothing would ever read it. Both arms fire at flow execution, where the approval node parses its config on entry — not at authoring time, and os lint has no pairing arm for this one. The refusal is loud, names both keys, and lands before the node opens any approval request.

Prefer a fallback target that cannot itself resolve empty (a user naming a real account, or the owner membership tier). If it does resolve empty the node degrades to admin_rescue — the request opens on the organization's administrators and the run is never killed — and the log says both that the fallback fired and that it found nobody.

The "previous approver picks the next step's approvers" loop needs no record field at all: declare decisionOutputs: [{ key: 'next_reviewers', multiple: true }] on node A (multiple: true because the answer is a list; a bare 'next_reviewers' takes one value), have the approver decide with { outputs: { next_reviewers: ['u2', 'u3'] } }, and let node B's approver be { type: 'expression', value: 'vars.<nodeA-id>.next_reviewers' }. The author declares output keys, approvers only fill values; undeclared keys reject the decision, and decision / requestId are reserved.

A declaration can also be typed — { key: 'next_reviewers', type: 'user', multiple: true } — which renders a multi-select user picker in the decision dialog instead of free text (department / team render the matching system-object picker and commit record ids; position renders a picker over the position registry and commits position machine names; multiple collects an array of them). The whitelist still works by key, so bare strings and typed declarations mix freely.

The runtime enforces every declaration at the decision, on an approve and a reject alike, before anything is written:

  • multiple: true takes a list, and only a list, with no entry twice. An absent or false multiple takes one value. This holds for every entry, text and bare strings included.
  • A picker output's values are also resolved, the way the matching expression approver's resolveAs expands them, in the request's organization: user, department and team by record id, position by the machine name of a position someone holds. A position name nobody holds is refused, and so is a sys_position record id: either would route to nobody.
  • A mismatch is refused with 400 VALIDATION_FAILED naming every outputs.<key> that does not match. No decision is recorded and the request stays pending, so the approver can decide again.

A text output (the default, and every bare-string entry) is judged by shape only: its value is free text. A blank value is left to required, below.

Add required: true when the next step cannot run without it — the very case above, where node B has nobody to route to if the lead skipped the field. Where type / multiple judge the shape of a value the approver supplies, required judges whether one is there: an approve carrying no value (or a blank one — '', []) for a required key is rejected before any write, so the run can never resume past the node with the key missing. A reject never requires it: the run leaves down the reject edge, where nothing reads the outputs. Enforcement has no elevation bypass — a one-click email action link and an auto_approve SLA escalation both fail rather than advance into a node that would resolve nobody, leaving the request pending and visibly overdue. Without the flag your only backstop is onEmptyApprovers — the next node opens, resolves nobody, and lands on the organization's administrators long after the approver who could have filled it in has gone.

The full lifecycle — submit to field change

What actually happens between "the flow hits the approval node" and "the record says approved":

The request opens, the run pauses

The node writes a sys_approval_request row: status: 'pending', pending_approvers (the resolved approver list), and — if you declared approvalStatusField — it mirrors 'pending' onto your record's field. The record is locked against edits while pending (lockRecord, default true), and the flow run parks until a decision arrives.

The lock applies to everyone except the run that opened the request. A flow may still write its own target record while its own approval is pending, so it can never deadlock against itself. The exemption is keyed on run identity rather than elevation, so a runAs:'user' run stays row-level-security scoped while it writes — it does not become a system write.

The record's lines are locked with it. Rows of a master_detail child of the locked record (an expense claim's lines, an opportunity's products) refuse insert, update and delete with the same 409 RECORD_LOCKED, and so does moving a row into or out of the record. The record lock's exemptions carry over: system writes and the run that opened the request still write the lines. Children joined by a plain lookup are not locked.

Deleting the record while it is pending is not refused: the delete lands and its pending request is cancelled (status: 'cancelled', with cancel_reason on the row), and the request's timeline says so in a system note, in the reader's language. The flow run that was waiting on that request is cancelled for the same reason, so neither the approve nor the reject branch runs: when the approval sits inside subflow steps on the same record, every run up that chain is cancelled too, and when the run is one item of a batch (map), the batch goes on to its next item and records the deleted one as cancelled. Runs left paused by deletes made before this release are not cleaned up automatically: find them by the cancelled request whose cancel_reason is record_deleted, which names its run in flow_run_id, and cancel that run by hand if it is still paused (requests voided by a delete after this release carry the same reason, and their runs already show cancelled). The delete removes the record's master_detail lines with it. In the cases below the server refuses the whole delete with 409 RECORD_LOCKED instead, and the record, its lines and its pending request all stay:

  • the line object has a second relation that also cascades on delete (a lookup with deleteBehavior: 'cascade', or a second master_detail), so the server cannot tell which record's delete removes the line;
  • the delete does not run inside an open transaction. This covers a datasource that declares supports.transactionsUnsupported, a cascade that spans more than one datasource, a record and its lines that sit together on a datasource other than the default one (the server opens its cascade transaction on the default datasource only), and a delete that carries the handle of a transaction that has already finished (for example from an async after-hook). The lines would be removed one by one, and a later refusal (a restrict reference to the record) would leave the record locked with its lines gone.

Inside a transaction the refusal is what keeps the lines: server code that owns the transaction must not catch the refused delete and commit anyway, or the lines are gone while the record stays locked.

Deleting a different record never removes a locked record's line, with one exception: when the locked record is itself the child of a record whose delete cascades to it (a master_detail child, or a lookup child with deleteBehavior: 'cascade'), deleting that parent removes the locked record and its lines, and cancels its request.

Reading the lock. Anyone who can read the record can ask whether it is locked, including a member who is not on the approval and so is served no request row:

curl -b cookies.txt \
  "https://your-app.example.com/api/v1/approvals/records/expense/rec_123/lock"
# → { "success": true, "data": { "locked": true, "lockSource": "record" } }

The answer is locked and, on a locked record, lockSource, and nothing else: no request, approvers or history, which stay behind the object's approvalsVisibleToReaders switch. locked is true while a pending request's node has lockRecord other than false. That is the same check the server applies when it refuses an edit with 409 RECORD_LOCKED, so a page that reads it never offers an edit the server will refuse. Asked of a line, it answers true while the record the line belongs to is locked.

lockSource says which approval holds the record, and so which delete the server refuses. "record": the record's own request holds it, and deleting the record still goes through and cancels the request. "master": the record is a line of a locked record, and the server refuses its delete as well as its edit. A line under a locked record that also has a pending request of its own answers "master". An unlocked record answers { "locked": false } with no lockSource.

The record is read as the caller: a record they cannot read answers 404 RECORD_NOT_FOUND, the same body a record id that does not exist gets. The SDK call is client.approvals.getRecordLock(object, recordId), and the service member is IApprovalService.getRecordLock. An approvals service without that member answers 501.

Reading the locks of a page of records. A list asks for every row on screen in one request rather than one per row:

curl -b cookies.txt -X POST -H 'Content-Type: application/json' \
  -d '{"recordIds":["rec_123","rec_456","rec_789"]}' \
  "https://your-app.example.com/api/v1/approvals/records/expense/locks"
# → { "success": true, "data": { "records": [
#      { "recordId": "rec_123", "locked": true, "lockSource": "record" },
#      { "recordId": "rec_456", "locked": false },
#      { "recordId": "rec_789", "locked": null } ] } }

Each entry is what the single-record read answers for that id, in the order the ids were sent; null stands where that read answers 404, so a record the caller cannot read and one that does not exist look the same. Send the ids as the server spelled them: an id the database matches only under another spelling (a different letter case, 07 for 7) answers null here. The single-record read does find such a record and answers for it, but it looks up the record's own request by the id as sent, so it may answer { "locked": false } for a record its own request holds; a line of a locked record still answers "master". The two reads keep these different rules on purpose (seat ruling 7152650156 on #37151). One request carries at most 200 ids (APPROVAL_RECORD_LOCKS_MAX_RECORD_IDS); a longer list, an empty one or any other body key is refused with 400 VALIDATION_ERROR. The SDK call is client.approvals.getRecordLocks(object, recordIds), the service member IApprovalService.getRecordLocks, and an approvals service without it answers 501. A list that edits in place reads it when a cell is first selected, and holds an edit asked before the answer arrives until it does.

Only approvers is required on the node; everything else has a default (behavior: 'first_response', lockRecord: true, maxRevisions: 3).

Approver entries resolve by kind — position, user, field, manager, team, department, org_membership_level, queue, expression and platform_admin (described in the callout above and in Dynamic approvers, and platform_admin in Routing to the platform administrators); org_membership_level is the one that silently resolves to nobody when it's mistaken for a business hierarchy. A queue entry names an ownership queue by its machine name — one an installed app declares, or one of the organization's own — and resolves to the queue's members at node entry, through the same expansion that decides who may claim the queue's records (ADR-0142 D6) — how to declare a queue, and what its members can do with the records parked in it, is in Queues and assignment rules. field, manager, and expression resolve against the record's live state at node entry (#3447); manager additionally depends on sys_user.manager_id, which a platform admin sets from Setup → Users → ⋯ → Set Manager — see the manager callout above. position, department, org_membership_level, queue and expression may additionally name which organization's directory resolves them — see Approving across organizations.

A position or queue name is not checked when the flow is saved: positions and queues are runtime data an administrator adds and removes, so a name nobody holds yet saves, and it is resolved when the run reaches the node.

Routing to the platform administrators

{ type: 'platform_admin' } routes the step to the deployment's platform administrators: the people with platform-administrator standing, which is a cross-tenant admin_full_access grant or a verified account whose email the deployment declares in OS_PLATFORM_OWNER_EMAIL. It takes no value and no organization.

  • One slot, nobody listed. The request opens on one slot, platform_admin:*, that names no person. At every inbox read and every decision, the server asks whether the caller has platform-administrator standing at that moment. A caller who has it sees the request under "My Pending" and decides it as an ordinary approver, and the decision records that person. A caller whose standing was revoked cannot decide it, even if the request opened before the revocation. An organization administrator neither takes the slot nor overrides the request: the tenant admin override below is withheld from any request whose slate holds platform_admin:*, including a mixed slate that also names ordinary approvers. An override decides the whole request, so a mixed slate is withheld whole, and its ordinary approvers still decide it as usual. The platform admin override is unchanged.
  • Only this type opens the slot. The rule holds on the slate as the decision, override and inbox doors read it: however else a slate is resolved or later rewritten, the slot is not opened through it. A request records, when it opens, that a platform_admin step opened its slot, and the doors honour the slot only on a request that carries that record. Moving the slot to someone else takes a platform administrator, the platform admin override, or the system.
  • Nobody is told. The slot names no person, so opening the request sends no notification, and the slot grants no read of the record. The request does not count as an empty slate, so onEmptyApprovers never replaces it with the organization's administrators. On a deployment where no one holds platform-administrator standing, no one can take the slot and the request waits with no warning, so give someone that standing before a package whose flow uses this type goes live. The request lists the slot as Platform administrators, in the reader's language on the approvals door.
  • Only the deployment's own packaged flows may use it. The approval node opens on this type only when the flow body it runs ships in a package the deployment registers in code (registry source: 'code'). The origin is answered for the body whose step is being opened, in every run state. Anywhere else, the node fails with a FORBIDDEN: error that says why, and writes no request. That covers a flow authored in the deployment, an environment override of a packaged flow, and a flow from a package installed from the marketplace or created in the deployment. Saving an active flow that names the type, in Studio or through /meta, is refused with approval-approver-platform-admin-authored. os lint accepts the type. It cannot know which door will register the package it reads. No designer offers the type.

What an entry that resolves to nobody leaves on the slate depends on its kind:

  • A person entry (manager, field) adds no slot. Nor does a queue with no members, or an expression that yields no ids. A user entry's value is the slot when an account carries that id or email; one that no account carries adds no slot, and logs the same expanded to nobody warning as a group entry.
  • A group entry (position, team, department, org_membership_level) keeps its <type>:<value> literal as a slot, and so does an expression value that resolveAs re-expands into a group with nobody in it. A position:<name> slot is decided by whoever is staffed into that position later. No person ever holds any other literal, so only an administrator can decide it (the admin-override callout under Acting on requests in the console). Beside entries that do resolve, a literal is a slot like any other, so a behavior that needs every slot (unanimous) waits on it too. A department or org_membership_level entry whose holder read failed (sys_business_unit_member or sys_member, and for a department also the sys_business_unit read of the unit and of its child units) keeps its literal the same way. It logs could not be expanded — a directory or read-filter lookup failed with the error, instead of expanded to nobody, and never routes to the holders that happened to read. An expression value whose resolveAs: 'department' read failed keeps its literal and logs the same line, with the expression source.
  • A failed read behind a team, position or queue entry is not an empty slate, and the node does not open (ADR-0142 D6). That is a failed sys_team_member or sys_user_position read, the sys_member read behind a position, or, for a queue, a failed read of its sys_queue row, its sys_queue_member rows or a member table one of its members reads. An expression value resolved as team or position, and a cross-organization read filter that fails in front of any of these entries, count the same. Under every onEmptyApprovers value, the fallbackApprovers slate included, the node fails with a retryable error starting APPROVER_DIRECTORY_UNREADABLE: that names the approver and the read, and writes no request. It is not opened on the rest of the slate, on the fallback or on the administrators, and it is not auto-approved. Run the flow again once the directory can be read. A decision on a request opened before approver snapshots existed still re-reads its slate the old way, which keeps the literal.
  • A slate left empty, or holding only literals, goes to the node's onEmptyApprovers policy, whose four values are listed under Approving across organizations. Under the default, admin_rescue, the request opens on the organization's administrators instead.

When a slate names no one

Under the default onEmptyApprovers: 'admin_rescue', a slate that names no person opens the request on the organization's administrators: the people who hold the organization-admin capability (organization_admin or organization_admin_no_bypass, ADR-0095 D3) in the request's organization. An organization's owners and admins receive that capability automatically. It is the same authority that lets a tenant admin override a request, resolved to the people who hold it.

They are ordinary approvers:

  • the request is in each administrator's queue and counted in their bell, under their own approverId, as for any approver;
  • each is told once, by approval.requested, and out-of-office delegation applies to them as to any named approver;
  • a decision by one of them is an ordinary approval or rejection, recorded with via_override: false. The node's behavior reads them as one group: under first_response, or per_group with the default minApprovals, one of them decides; unanimous and quorum count them as they count any slate.

A platform administrator is not added for being one: that standing crosses the tenant wall, and the slate is the organization's own. One who also holds the organization's capability, such as its owner, is on the slate for that.

The request says why. Its timeline carries a note, for example Routed to this organization's administrators because the approver slate named no one: position 'sales_manager' has no holder. That English, with the position's name, is what the row stores; a reader is served the note in their own language, and it names the position by its label (the language pack's translation, else the position's declared label), for example 岗位「销售经理」无人任职. The timeline shows the note as a system note, by the system. Its node-config snapshot keeps the abandoned slate and the same reason under __resolvedFrom (admin_rescue:abandoned, admin_rescue:reason). The abandoned slate is replaced, not kept beside them: a holder staffed into the position after the request opened does not receive it, and an administrator can reassign it to them.

To name the person who should decide instead, declare onEmptyApprovers: 'fallback' with fallbackApprovers. Only an organization with no administrator, or a request with no organization, still opens on the slate that names no one, and so does a request whose organization's only administrator is its submitter on a step that sets excludeSubmitter. The server logs a warning, and the request's timeline and a notice to its submitter say that no one else can approve it yet and that an organization administrator must add a member who can (one who holds the unstaffed position, when the slate names one). The timeline's note names that position the way the note above does: by its label for a reader, by its name in the text the row stores. Only the admin override decides it, and never its submitter's own.

The approver finds it in their queue

The approver's surface is the Approvals Inbox — in the stock console, the Approvals entry in the account menu. It lists what is waiting on the current user (status = pending, pending_approvers containing them — their user id, the email their own account carries, or the position:<name> literal of a position they hold) and it is the only surface that carries the decision actions: approve, reject, return, reassign, request info, delegate, remind, override.

Why the raw sys_approval_request table is not that surface. Every action on the object is gated on the record.viewer flags (can_act, is_submitter, or an override flag), and the viewer block is computed and attached only by the approvals REST path (/api/v1/approvals/*) — never by the generic data API a plain object view reads. Browse the table directly and you get a correct, completely inert list: the rows are there, the buttons are not. That inertness is now a considered false rather than an evaluation fault — the predicates guard the block with has(record.viewer) && has(record.viewer.can_act) before reading it, so a row without the block resolves cleanly instead of aborting at key resolution. Same empty toolbar, arrived at deliberately. The table stays available under Setup → Approvals → Requests for admins and diagnostics, which is what it is good for.

Programmatically the same queue is:

curl -b cookies.txt \
  "https://your-app.example.com/api/v1/approvals/requests?status=pending&approverId=usr_123"

approverId accepts a user id, an email, or a <type>:<value> approver literal (position:finance_manager — the form a group entry falls back to when it resolves to no users) — and takes several values (comma-separated or repeated) to cover a person's identities in one call. A position literal matches under position:<name>, the one spelling the service admits a holder of that position under as their own identity. The deprecated pre-rename prefix is no alias of it (ADR-0090 D3): it matches only a slot stored under that exact spelling, and no holder acts under it. Other filters: status, object, recordId, submitterId, q, limit, and offset.

approverId is a filter, not authorization. What you may see is decided separately: a request is visible to its participants — the submitter, a current approver (counted by every identity the decision routes let the caller take a slot under: their user id, the email their own account carries, and the position:<name> address of a position they hold), and anyone who has already acted on it (a past approver whose slot has moved on, a commenter). An action is recorded under the slot it took, so "already acted" is counted by those same identities: a decision taken on a position:<name> slot keeps the request visible to whoever holds that position. So omitting approverId returns your requests, not every request in the tenant. Admins with override authority (admin_full_access, or organization_admin within their org) see all of them — that is what the "all requests" view is for.

The same rule governs a decision's files: an attachment is exactly as readable as the decision it hangs off, never more (sys_approval_action delegates that question back to this service via fileAccessDelegate).

Every signed-in member holds a read on sys_approval_request through the member baseline (member_default), and the data door serves them exactly the requests the rule above lets them see, with the same snapshot redaction. So GET /api/v1/data/sys_approval_request (and an MCP agent's query_records) lists a member's own requests, and a pending_approvers filter on {current_user_id} finds the requests waiting on them, including a step addressed to their email or position. No write opens on it.

The two objects' definitions follow. The metadata API answers an object the caller may not read as absent; with the baseline read, every member is served the sys_approval_request definition, projected by their field-level security. sys_approval_action stays closed to ordinary members on the data side, and both objects declare schemaReadDelegate: 'approvals', so GET /api/v1/meta/object/sys_approval_action (and the object list) serves it to a caller who can see at least one request by the rule above. A member who can see none is answered 404 for it.

Whoever reads sys_approval_action rows on the data side (Setup's Approval Actions list, an action's record page, an export) is served each row's step label and system note in their own language, by the same render as the request's timeline. The row itself keeps the authored step label and the English note.

Opening a step tells its approvers. When a request opens, each concrete approver on its slate gets one approval.requested notification ("Approval requested", linked to that request in the Approvals Inbox): a named user, every holder of a staffed position or member of a team, the fallbackApprovers when the node's onEmptyApprovers: 'fallback' opened on them, and the organization's administrators when the default admin_rescue opened on them. It goes through the installed messaging service, the same way as the reminder, reassignment, escalation, and return notifications, and the same delivery preferences apply. Without a messaging service, no approval notification is delivered at all.

Two cases tell nobody by design. A slot no one holds (position:<name> with no holders) names no person, so it is told nothing; a step whose whole slate names no one is decided by its onEmptyApprovers policy, and only in an organization with no administrator does the default leave no one to tell. An out-of-office delegate gets one message, approval.ooo_substituted, not a second one for the opening.

If a flow has a notify node beside its approval node only to tell the approvers that a request is waiting, remove that node: those approvers are now told twice. Keep notify nodes that address someone else, such as a watcher, or that report the decision to anyone but the submitter.

The decision tells the submitter. When a decision ends the approval, the submitter of the request it decides gets one notification: approval.approved ("Request approved") or approval.rejected ("Request rejected"). Its body names the record and the outcome, followed by the decider's comment when they wrote one, and it links to that request in the Approvals Inbox. Like every approval notification, it names the record by its object's label and its title as that recipient may read it (Deal Acme renewal), and by its id (Deal D_123) when the title is empty or the recipient's field-level security hides the title field. The one-tap email action pages always name the record by its id, because they are opened with a token rather than a session. There is one topic per outcome, so a delivery preference can mute approvals and keep rejections.

"Ends the approval" means the process, not the step. A co-sign vote that leaves a unanimous, quorum or per_group request pending tells no one, and neither does a decision whose flow moves on to another approval step: on a two-step flow the first step's decision is silent and the decision that ends the run is the one that notifies. Whether a later step opened is read from the run, not from the flow's graph, so when a decision node routes around the later step, the first decision is the outcome and notifies. The run here is the one that carries the request's record: a step decided inside a subflow whose parent then opens the next step is silent too, while each record of a map over records is told its own outcome when its last step is decided.

Two cases tell nobody by design. A submitter who decided their own request already knows. An SLA auto_approve or auto_reject is told by the escalation's own submitter notice (approval.sla_breached, which names the action taken), so notifySubmitter: false still means the submitter hears nothing about it.

If a flow ends with a notify node whose only job is to tell the submitter the decision, remove that node: the submitter is now told twice.

Mount the approvals inbox in your app

Approvals are cross-cutting: people approve expenses inside the expenses app, not by leaving for a platform app. Add one navigation entry to any app you ship and that app gets the full inbox:

// my-app.app.ts
navigation: [
  // …
  {
    id: 'nav_approvals',
    type: 'component',
    label: 'Approvals',
    componentRef: 'approvals:inbox',
    icon: 'check-circle',
    // Hide the entry where the approvals plugin is not installed. Enforced
    // server-side: a gated-off entry never reaches the browser.
    requiresService: 'approvals',
  },
],

componentRef names a component-registry key, not a URL. The console owns the route it resolves to, so approvals:inbox keeps working if that route ever changes — never hand-write a console path into app metadata.

The inbox is per-user, not per-app: it shows the signed-in user everything waiting on them across every object, because "what is waiting on me" is a property of the person and not of the app they happen to have open. Filtering it down to one app's objects is not an option today.

The platform's own Account app mounts it exactly this way, and Setup → Approvals → Approvals Inbox mounts the same component for admins above the raw sys_approval_request / sys_approval_action / sys_approval_delegation tables.

The decision

curl -b cookies.txt -X POST \
  https://your-app.example.com/api/v1/approvals/requests/req_456/approve \
  -H "Content-Type: application/json" \
  -d '{ "comment": "Within budget." }'
# POST .../reject for the other direction; body: { actorId?, comment }
# a reject's comment is its reason: required, a non-blank string

actorId defaults to the caller, who takes the first slot in pending_approvers keyed by one of their identities — their user id, the email their own account carries, or the position:<name> address of a position they hold (the literal left by a position nobody held when the request opened, once someone is staffed into it). A named actorId must be one of those identities, and a named position:<name> takes that position's slot; the deprecated pre-rename prefix is not one of them (ADR-0090 D3) and returns 403 (FORBIDDEN: cannot act as '…'). A request the caller may not read, and no admin override covers, returns 404 (REQUEST_NOT_FOUND), exactly as an id that names no request does — on every door that acts on a request, before any other check of it. For a caller who can read it, no such slot and no admin override returns 403 (FORBIDDEN: actor '…' is not a pending approver). An administrator who submitted the request and holds no slot on it also gets 403 (FORBIDDEN) on approve: the admin override never approves its actor's own request (see the admin-override callout below). A request that isn't pending returns 409 (INVALID_STATE). The decision records two facts on its sys_approval_action row: actor_id is the user who decided, and acted_as is the slot the decision took, in that slot's stored spelling — the multi-approver tally counts approvals by matching acted_as against the slate. A reassign row records the slot it moved the same way: reassign_from and reassign_to hold slot addresses (a user id, an email or a position address), not users. Always go through these endpoints — never resume the flow run directly, and since #3801 you cannot: POST /api/v1/automation/{flow}/runs/{runId}/resume answers 403 for a run parked on an approval node (including via a subflow pause) and changes nothing — the request stays pending and the run stays parked, so the real decision still lands. The approver slate, the sys_approval_action row and the status mirror all live on this path; it is the only one that produces a consistent outcome.

A decision may carry file attachments — attachments: string[] of sys_file ids — recorded on its audit row (e.g. a signed contract on the approve):

POST .../approve   { "comment": "Signed.", "attachments": ["file_abc", "file_def"] }

With behavior: 'unanimous', an approve is not the end. Every approver but the last only trims pending_approvers; the request stays pending (finalized: false) and the flow stays parked. Only the final approval finalizes it.

The record changes and the flow resumes

On finalization the request row gets status: 'approved' (or 'rejected'), pending_approvers: null, and completed_at; your approvalStatusField is mirrored to the same value, and the record unlocks. The parked run resumes down the approve or reject branch.

Statuses in full: pending, approved, rejected, recalled, returned, cancelled (the platform voided the request, for example because its record was deleted; cancel_reason on the row says why) — the APPROVAL_STATUSES constant in @objectstack/spec/contracts, which is also what sys_approval_request.status offers and what ApprovalStatus is derived from. If you add a status there, this line is a fourth copy that nothing updates for you.

The resumed half is not covered by the flow's errorHandling.retry. A durable pause ends the retry-governed segment, so strategy: 'retry' on the flow protects the work before the approval and gives whatever fails after the decision exactly one attempt. Wrap the post-decision work in a try_catch node with its own retry (or draw a fault edge to a handler) — see A durable pause ends the retry-governed segment. It is also the shape you want regardless: a flow-level retry re-runs the flow from the start, which would open a second approval request.

A refusal on the step after the decision. Say the approve branch updates the record and that record's beforeUpdate hook refuses the write (a declared refusal, a validation rule, a permission). With no fault edge on that step, POST …/approve answers 500 RESUME_FAILED. The decision still stands (finalized: true), the run is stranded (runId, and repairable says whether an operator can re-arm it), and the body also carries the refusal: innerRefusal ({ code, message }) and the hook's userMessage, the sentence to show the approver. Draw a fault edge from that step to a handler, for example one that sends the record back to its owner, and the engine routes the refusal there instead: the decision answers normally and the run finishes without an administrator.

Beyond approve/reject — the full decision surface

approve / reject move the flow; the rest are thread interactions and continuity levers on the same request. All are POST /api/v1/approvals/requests/:id/<verb>; the service enforces who may call each:

VerbRouteWhoEffect
approve / reject/approve /rejectpending approverRecords the decision (finalizes per behavior). Accepts comment (a reject's reason — required at every human door, see below), attachments, and — when the node declares decisionOutputs — structured outputs handed to the flow as <nodeId>.<key> variables.
reassign/reassignpending approverHands their own slot to another user (to); the request stays pending. A from naming a slot the acting approver does not hold is refused 403 FORBIDDEN; an administrator (the override) or the system may move any pending slot.
revise (send back)/revisepending approverEnds this round as returned, unlocks the record for rework (ADR-0044).
request-info/request-infopending approverAsks the submitter for more info; the request stays pending. comment required.
remind/remindsubmitterNudges the pending approvers (publishes a notification topic).
recall/recallsubmitterWithdraws a pending (or abandons a returned) request → recalled.
resubmit/resubmitsubmitterAfter a send-back, re-enters the approval node and opens the next round (ADR-0044).
comment/commentparticipantFree-form reply on the request thread; accepts attachments.

Send-back → resubmit (ADR-0044). An approver who wants changes rather than a hard reject calls revise: the round finalizes returned, the record unlocks, and the run parks in the revise window — an approval_revise node on the flow's revise edge. The submitter reworks the record and resubmits (a fresh round opens for all approvers) or recalls (abandons it). Past the node's maxRevisions budget (default 3) a send-back auto-rejects instead. The flow's approval node must declare a revise edge, and that edge must target an approval_revise node, for send-back to be available. A recall from the revise window cancels the run; when that run is an item of a batch sign-off (a map over approval items), the recall also wakes the batch, which records the item's slot as the cancelled marker { $status: 'cancelled', $itemRunId } and moves on to its next item or its end.

A request with no submitter. A run whose trigger resolved no user (a schedule, time-relative or api trigger, or a record-change fired by a system write) opens its request with no submitter. An approver can still send it back, but once it is returned nobody can recall it: recall reaches a returned request for its submitter alone, never the system or the admin override, and no viewer sees Resubmit or Recall. Its one way out is a resubmit made by server-side code in a system context (IApprovalService.resubmit with isSystem: true, and an actorId naming the acting identity, which a system caller must supply). That opens the next round pending, again with no submitter, where the system or the admin override can recall it. On a flow whose trigger never carries a user (schedule, time-relative or api), keep the revise edge into its approval_revise node only when server-side code will make that resubmit: the window is the only shape send-back accepts, and nothing in the run can end it. Otherwise leave the revise edge off, so send-back is refused and approvers reject instead. A record-change flow has no submitter only when a system write fired it; such a round, once sent back, waits in the window for that server-side resubmit, or a platform operator's POST /api/v1/automation/:name/runs/:runId/cancel discards the run and leaves the request returned.

The window is deliberately not an ordinary wait: resubmit is what authorizes (submitter-only), orders (latest round) and records (an audit row) the continuation, and refuses when another request is already pending on the record — so the pause it parks on declares resumeAuthority: 'service' and the generic POST /api/v1/automation/:name/runs/:runId/resume route answers 403 for it. ADR-0044 D3 originally prescribed a wait here; its 2026-07-28 amendment reversed that (#3823). A flow still carrying the old shape publishes with an error (flow-approval-revise-target-not-service-owned) and its revise verb is refused at runtime until the node's type is changed — approve/reject are unaffected.

Acting on requests in the console

You rarely call these routes by hand. The decision verbs above ship as server-declared actions on sys_approval_request (actions[] in its object metadata) — approval_approve, approval_reject, approval_reassign, approval_send_back, approval_request_info, approval_remind, approval_recall, approval_resubmit, approval_comment. approval_comment is the thread reply: a pending approver sees it, and so does the submitter while the request is pending; it has no admin-override arm. The console's generic action runtime renders and executes them wherever the object is surfaced — the Approvals inbox included — so a decision (comment, a file-upload for attachments, the reassign user-picker) is collected by the generic action dialog with no per-action UI code. New decision capabilities ship as backend metadata, not hand-written buttons. Every human reject carries its reason: approval_reject declares its comment param required, so the action door, MCP run_action and the dialog refuse a reject whose comment is missing or blank (400, the declared param contract's required refusal), and ApprovalService.decide(), behind the /reject route and the SDK's client.approvals.reject, refuses one the same way (400 VALIDATION_ERROR); the inbox keeps Reject disabled until a reason is typed. The email action link asks too: its reject confirm page has a required reason field, and a reject sent with a blank one is answered the page again (400) with the link still unused.

On the record itself, a record with approval requests grows an Approvals tab beside Details and Related, with a request-count badge: the current step, decision progress, the approvers it is waiting on, the merged decision timeline and a remind button for the submitter. Every viewer who can read the record sees it, not only approvers. A request opens on its record page through the approvals routes rather than the data API, so an approver who is not an administrator sees the whole page, decision actions included, even where the data API does not serve them the request row.

Each action's visibility is gated by a server-computed per-viewer block the service attaches to every request it returns:

// getRequest / listRequests responses carry, per the calling user:
"viewer": { "can_act": true, "is_submitter": false, "can_override": false, "can_override_approve": false }
  • can_act — the caller is a current pending approver: while the request is pending, the caller with no actorId named would take one of its slots — under their user id, the email their own account carries, or the position:<name> address of a position they hold. It is computed by the same function the decision routes authorize with, so it reflects position/team/manager resolution and a position:<name> slot whose position was staffed after the request opened.
  • is_submitter — the caller submitted the request.
  • can_override — the caller is a platform or tenant admin who may act on a pending request despite holding no slot (see the admin-override callout below).
  • can_override_approve — can_override, except on a request the caller submitted: the override never approves its actor's own request. It is added beside can_override, which keeps its meaning for Reject, Reassign and Recall; a client that gates its own Approve control on the override reads this flag. A server that predates it does not send it.

Approver actions gate on record.viewer.can_act, submitter levers (remind/recall/resubmit) on record.viewer.is_submitter, Reject/Reassign/Recall additionally OR in record.viewer.can_override, and Approve ORs in record.viewer.can_override_approve. So a submitter who holds no slot and is not an administrator never sees Approve, Reject or Reassign on their own pending request (buttons the server would 403 anyway); one who is an administrator sees Reject, Reassign and Recall on it, and never Approve. A position-addressed approver is never wrongly hidden, and an admin can rescue a stuck request. The service stays the sole authority — the predicate only trims the UI.

Admin override — recovering a stuck request. A slate that names no one opens on the organization's administrators under the default admin_rescue (When a slate names no one), so the override is break-glass for what that cannot reach: a request whose named approvers have all left after it opened, and an organization with no administrator, where the request opens on its <type>:<name> literals. A position:<name> slot is decided by whoever holds that position once someone is staffed into it; until then — and for a team or department literal, always — no concrete user can act, and (with lockRecord) the record stays locked. A platform admin (admin_full_access) or tenant admin (organization_admin, org-scoped) may act on any pending request — approve, reject, reassign it to a real approver, or recall it — releasing the lock. The one exception is a request whose slate holds the platform administrators' slot: a tenant admin cannot override it (Routing to the platform administrators). An admin decision is authoritative: it finalizes the node even under unanimous/quorum/per_group, and is audited under the admin's own id. Prefer a guaranteed-staffed fallback approver so the set is never empty in the first place.

The override never approves a request its actor submitted, and is never the means by which they take a slot on it. Whatever the step's excludeSubmitter says:

  • an administrator who submitted a request and holds no slot on it gets 403 FORBIDDEN from approve;
  • an override reassign never hands a request to its submitter, whoever makes it: a target naming them (their user id, or their email in any letter case) or a position only they hold answers 400 VALIDATION_FAILED;
  • when the submitter makes the override reassign themselves, every target they could act under is refused the same way, a position they share with others included.

Rejecting or recalling their own request stays open to them. A different administrator may still reassign the request to a position the submitter shares with others: the submitter is then one of its holders, and whether a holder may approve their own request is excludeSubmitter's question, as it is for any submitter who holds a real slot on the step.

If your own request is stuck, reassign it to someone who can decide it, or recall it — which unlocks the record — and send the record for approval again. The new request resolves its approvers afresh: when they still name no one, it opens on the organization's administrators under admin_rescue, as ordinary approvers. Without excludeSubmitter: true on the step, a submitter who is one of those administrators is on that slate and may approve the request as an ordinary approver; a step that sets it keeps the submitter off the slate, so another administrator decides.

The same override is the only way to decide a slot no position holder addresses since ADR-0090 D3 retired the pre-rename word: a request a 15.x-era release stored under the pre-rename prefix, and a request opened from a flow that still authors the deprecated approver type (above) with a position name as its value (its slot is org_membership_level:<name>). Approve or reject it as an admin, or reassign it to the position's holder, who then decides it normally; then change the flow to { type: 'position', value: '<the position>' }.

Note the rule is "the actor is an admin", not "the slate is unstaffed" — so an admin can also act on a request whose slate is properly staffed, bypassing the people on it. That is why the decision records which door it came through: sys_approval_action.via_override is true when the actor was admitted only by this privileged path, holding no slot themselves. An admin who is also a designated approver is approving normally and records false — the flag is about the branch that authorized the call, not about who holds admin rights. A row written before the column existed carries no value at all, which reads as not recorded rather than as not an override. Without it, an override and an ordinary approval were byte-for-byte identical. The slate's approvers are not told either: once the override decides the request it is no longer pending on them, so it leaves their queue. An approver with no other read on it loses sight of it, and reading or deciding it answers 404 REQUEST_NOT_FOUND, as for any request they may not read. One who keeps a read — they already acted on it (under their own id or a position slot they hold), they submitted it, or the object's approvalsVisibleToReaders lets record readers read its approvals and they read the record — still sees it decided, and a decision answers 409 INVALID_STATE.

A dead run releases its own lock. If the flow run that opened an approval reaches a terminal state without a decision — it failed, was cancelled, timed out, or the process hosting it crashed — nothing is left to decide the request, so a periodic sweep finalizes it as recalled and releases the record. The audit row records no actor — a sweep is not a user, so actor_id is empty, never a placeholder value (ADR-0118 D1) — and names the run and its status, so it reads distinctly from a submitter's own recall, which records the submitter.

The sweep only ever acts on a run it can positively confirm is terminal: a paused run (the normal state of a live approval), an unknown run, or an unreachable automation engine all count as alive and are left untouched. It frees orphaned records; it never cancels a live approval.

That sweep scans pending requests, which leaves one shape outside it: a request already decided — approved, rejected or returned — whose run has since vanished. The decision landed and the flow never moved, and flipping the request out of pending is precisely what removed it from the sweep's view. A second, read-only inspection rides the same clock for those: it reports a terminal request only when the suspension store says no live pause exists and no terminal run record exists either, skipping (never condemning) any row whose store could not be read. It deliberately does not rewrite them — the decision really happened, and rolling it back automatically would put the audit trail at odds with the facts — so it names the stuck requests, their step, and the stale mirrored status for an operator to act on. Each sweep reads the 500 most recently decided requests, so a new strand is named on the next sweep, plus the next 500 of a walk over every decided request by id that resumes where the previous sweep stopped, so an older one is named within one pass of the walk however many decided requests a deployment holds.

A pending multi-approver request also carries a server-computed decision_progress block, so the console shows real progress rather than a client guess:

// getRequest, for a pending multi-approver request:
"decision_progress": {
  "behavior": "per_group",
  "got": 1, "need": 2,                 // unanimous / quorum: a running M-of-N tally
  "groups": [                          // per_group: one entry per approver group
    { "label": "manager", "got": 1, "need": 1 },
    { "label": "finance", "got": 0, "need": 1 }
  ]
}

It is computed from the open-time approver snapshot (OOO substitution applied), so it reflects who actually still needs to sign — the console renders it as per-group tick badges or a "2 of 3 · finance pending" count.

The same read serves the request's own route, flow_route, which both approval step lines draw (the record's approvals panel and the request page):

// getRequest, for a contract a gateway routed from the manager to finance:
"flow_route": {
  "steps": [
    { "id": "manager_review", "label": "Manager", "state": "done" },
    { "id": "finance_only",   "label": "Finance", "state": "current" }
  ],
  "ahead": "undecided"                 // a gateway follows: nothing past it is listed
}

done steps come from the run's own request rows (earlier requests of the same run, approved), never from the flow graph. Steps upcoming are listed only for a pending request, and only as far as the graph decides them when each step approves: the walk stops at a decision, a conditioned edge, several out-edges, a loop back or a subflow / map / loop node, and ahead reads undecided. ahead is end when the walk reached the flow's end, and decided for a request already decided. The older flow_steps member is the graph's first branch at every decision, not the route; nothing draws it.

A decided request's route also says where the record's approval stands now, in outcome, so its step line can answer "what happened next":

// getRequest, for the manager's request after the manager approved:
"flow_route": {
  "steps": [{ "id": "manager_review", "label": "Manager", "state": "done" }],
  "ahead": "decided",
  "outcome": {
    "step": { "id": "finance_only", "label": "Finance" },  // the run's latest, later request
    "status": "pending",                                     // it waits on its decision
    "ended": false                                           // the run goes on
  }
}

step is the run's latest request opened after this one (a pending one first), and is absent when none was opened; status is that request's status, or this request's own without a step; ended is true only when the record's approval is known to have stopped: the request's run is a root run (an approval inside a subflow or a map item runs in a child run, whose end is not the approval's), the flow body the run ran holds no subflow or map node anywhere (a child run files its requests under its own run, so the root run's requests cannot show what it decided), and the run has stopped for good. The body the run ran is known only while the flow has not been registered again since the run started: after an edit, a rollback or a restart, older runs are not judged by today's body, and their requests are not served "ended". false means not known to have stopped, including a run that cannot be read. So on a flow that starts a child run, a decided request's line names the later steps of its own run but never says the approval ended. outcome is left out when nothing past the request is known: no later request and the approval not known to have ended, or several later requests pending at once. Every reader of the request gets it; it names only the later step and its status, never that request's approvers, comments or field values.

Approval notifications deep-link into the request: notify() rewrites the inbox action URL to /system/approvals?request=<id>, so clicking the bell opens that request's drawer directly instead of a generic list.

Timeouts and escalation

escalation is real, not decorative: set enabled: true and timeoutHours, and pick an action — notify (default), reassign, auto_approve, or auto_reject. Auto decisions run through the normal decide path, so the flow resumes exactly as if a human had clicked. Every escalation writes an audit row of kind escalate naming the configured action; it, the auto decision that follows it, and the escalation's notifications record no actor, because no person acted (ADR-0118 D1). timeoutHours counts from the moment the request was submitted, and clock decides how its hours count (ADR-0157 D5):

  • wall_clock (the default) counts every hour — nights, weekends and holidays included — so a request opened at 17:00 on a Friday with timeoutHours: 4 escalates at 21:00 that same Friday.
  • working_time counts only the working periods of a working calendar (sys_work_calendar, kept by the organization's administrators in Setup), skipping its holidays and counting its make-up workdays. With 09:00–12:00 and 13:00–18:00 working periods, the same Friday request escalates at 12:00 on the next working day: Monday, or Tuesday when Monday is a holiday, or the Saturday itself when it is a make-up workday.
escalation: {
  timeoutHours: 4,
  clock: 'working_time',
  calendar: 'cn_standard', // optional: the organization's default calendar when left out
  action: 'notify',
  escalateTo: 'approvals_supervisor',
}

The calendar is the one calendar names, else the organization's default calendar; there is never a fallback to wall-clock hours. The deadline is counted again on every sweep and every read, so a holiday entered after a request opened moves its deadline (an escalation that already fired stays fired). When the calendar cannot count the deadline — no calendar has that code, the organization has no default, or the calendar is not maintained as far as the deadline needs — the request does not escalate. Its read carries no sla_due_at and a sla_due_refusal instead (the refusal code, its reason or the date it needs, and a message), the approvals inbox shows "Calendar can't compute" with the reason, and the next sweep tries again, so fixing the calendar is the only step. Publishing checks only what is written: a calendar beside the wall clock is refused (approval-escalation-calendar-without-working-time), since nothing would read it; whether the named calendar exists is the organization's data, checked when the deadline is counted.

Escalation needs the job service. The plugin sweeps pending requests on an internal timer (~5 min). Without a job service registered, SLA timers are display-only and no escalation ever fires.

Out-of-office delegation

An approval routes to a specific person, and people take leave. Declare an out-of-office delegation so an approver's individually-routed slots reroute to a backup while they're away — the approval never freezes:

curl -b cookies.txt -X POST \
  https://your-app.example.com/api/v1/data/sys_approval_delegation \
  -H "Content-Type: application/json" \
  -d '{
    "delegator_id": "usr_alice",
    "delegate_id":  "usr_bob",
    "valid_from":   "2026-05-26T00:00:00Z",
    "valid_until":  "2026-05-30T00:00:00Z",
    "reason":       "Annual leave"
  }'

When a request opens, approvers that resolve to a specific individual (type: user, type: field, type: manager) are checked against active delegations and rerouted to the delegate. The window is half-open [valid_from, valid_until) (UTC), evaluated at resolution time — no background job — so a lapsed delegation simply stops applying. Chains (A → B → C) are followed and cycle-safe. The delegate acts under their own identity; the reroute is recorded as an ooo_substitute audit action and both the delegate and the skipped approver are notified.

A delegation that could never reroute anything is refused at the write with 400 VALIDATION_FAILED, naming the field: a window whose valid_until is at or before its valid_from (on valid_until), and a delegate_id equal to the delegator_id (on delegate_id). Leave either bound empty for an open-ended window. A row stored with either shape before this check existed stays inert: correct its dates or its delegate, or delete it.

A delegation belongs to the organization it is created in, and reroutes only the approvals opened in that organization; a request's organization is its record's. To cover approvals in two organizations, create a delegation in each. A delegation that names no organization, which only a database upgraded from before 18.0 can hold, reroutes nothing, and the approval service logs a warning naming it (ADR-0131).

Group-routed approvers are not rerouted. type: position / team / department / org_membership_level keep their whole membership, so there is nothing to skip; a position-holder's leave is handled by position delegation (ADR-0091), not here. Out-of-office delegation is self-service — create your own row via the data API (Setup → Approvals → Delegations (OOO)). For a single in-flight request, reassign hands one slot to another user directly.

Error codes

CodeHTTPMeaning
VALIDATION_FAILED400Malformed request
FORBIDDEN403Actor can read the request but may not take this action (not a pending approver, or not the submitter for a submitter-only verb)
REQUEST_NOT_FOUND404No such request — or one the caller may not read: every door that reads or acts on a request gives both the same answer
DUPLICATE_REQUEST409A pending request already exists for this record
INVALID_STATE409The request is no longer pending
THROTTLED429Rate limited

Best practices

✅ DO:

  • Define clear entry criteria
  • Set reasonable timeout periods
  • Allow recall when appropriate
  • Notify all stakeholders
  • Track approval history

❌ DON'T:

  • Create too many approval steps
  • Make approvals too complex
  • Forget rejection paths
  • Hard-code approvers

Why

Separating who configures from who approves from as whom it runs is the same capability/assignment/requirement decoupling as the rest of authorization (ADR-0066). The runAs default of user means an approval flow can't silently grant the submitter cross-tenant or cross-owner reach — elevation is opt-in and auditable. That is the safe-by-default posture: the common case respects RLS; the elevated case is explicit.

Runnable example

Anti-patterns

  • runAs: 'system' everywhere "to make it work". Default to user; elevate a single step only when it genuinely needs to bypass RLS.
  • Exposing automation config to approvers/submitters. Configuring the flow is a manage_metadata (builder) concern; acting on a request is not.
  • Gating "Approve" only in the UI. Make approve_* a capability and gate the action so the server enforces it too.

See also

On this page