Defines REST CRUD endpoint schemas for managing automation flows, triggering executions, and querying execution history.
Automation API Protocol
Defines REST CRUD endpoint schemas for managing automation flows,
triggering executions, and querying execution history.
Base path: /api/v1/automation
The wire paths the platform serves: the dispatcher mounts this door at its
prefix (default /api/v1, the one objectstack serve uses) plus
/automation. A drift pin in @objectstack/runtime
(automation-api-contract-mounts.test.ts) holds every path in
AutomationApiContracts to that mount table.
The flow LIST is not on this door. Flows are metadata (ADR-0106), and the
governed read of them is GET /api/v1/meta/flow (client.meta.getItems);
the former GET /api/v1/automation list route, its request/response schemas
and client.automation.list are retired (ADR-0087 semantic entry
automation-flow-list-route-retired).
The toggle door switches PACKAGED flows only: a flow a code package ships.
It records the installation's choice in the packaged-metadata activation
ledger (ADR-0126 §7.2). A flow authored in the deployment is not switched
there. Its switch is its own status: 'obsolete' disarms it and
'active' arms it, published with the complete definition through
PUT /api/v1/automation/:name. The toggle door refuses such a flow with
409 RESOURCE_CONFLICT, names that switch, and changes nothing. It refuses
the same way a switch ON of a packaged flow whose own status disables it
('obsolete' / 'invalid'): the ledger row alone would leave the flow off
while the caller read it as on, so it answers 409 RESOURCE_CONFLICT,
names publishing the definition 'active', and writes nothing. A switch
OFF of such a flow is accepted and records the choice.
Endpoints
GET /api/v1/automation/:name — Get flowPOST /api/v1/automation — Create flowPUT /api/v1/automation/:name — Update flowDELETE /api/v1/automation/:name — Delete flowPOST /api/v1/automation/:name/trigger — Trigger flow executionPOST /api/v1/automation/:name/toggle — Enable/disable a packaged flowPOST /api/v1/automation/:name/clone — Copy a flow, switched off, into a packageGET /api/v1/automation/:name/runs — List execution runsGET /api/v1/automation/:name/runs/:runId — Get single execution runPOST /api/v1/automation/_record-starts — Flows a proposed record update would start
The copy's machine name — mandatory, and a name no flow uses (ADR-0126 §7.1): the automation engine keys flows by bare name, so a taken name is refused 409 RESOURCE_CONFLICT.
label
string
✅
The copy's display name — mandatory, so the copy and its source are told apart in every list.
package
string
optional
Id of the package the copy lands in. Given, it must be an installed, writable package whose dependency closure holds the source's package: an unknown or read-only one is refused 422 WRITABLE_PACKAGE_REQUIRED, one that declares no dependency path to the source's package 409 RESOURCE_CONFLICT, and nothing is written. Omitted, the copy lands in the source's paired customization package <base>.custom, created on first use; a source no read-only package ships has no pair, and the request is refused 400 VALIDATION_FAILED located on this member.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
The copy as stored: switched off, in packageId, with no lineage.
packageId
string
✅
The package the copy landed in: the one the request named, else the source's paired customization package <base>.custom.
notice
string
✅
One line for the administrator, in the server's words: the copy is switched off until someone switches it on, and its references are not re-pointed.
noticeCode
string
optional
A stable code naming the notice sentence beside it, so a client can show that sentence in its own language: a client maps a code it knows to its own translated sentence, and falls back to notice verbatim for a code it does not know or when this key is absent (an older server sends none). The values are the server's; notice stays the English fallback.
Text for a terminal success, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of a generic "Done". A {{ }} template over the run's variables ({{ enrolledCount }} contacts enrolled), rendered when the run completes.
errorMessage
string
optional
Text for a terminal failure, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of the raw error. A {{ }} template over the run's variables, rendered over the variables at the failure point.
version
integer
optional (default: 1)
Version number
status
Enum<'draft' | 'active' | 'obsolete' | 'invalid'>
optional (default: "draft")
Deployment status
defaultActive
boolean
optional
Packaged flows only: false ships the flow switched off, so it is not armed on an installation until an administrator turns it on with the packaged-flow switch (the activation ledger); the administrator's choice, once made, wins over this default across restarts and upgrades. Absent or true: switched on. status stays the author's switch: obsolete/invalid disarm the flow everywhere. A flow authored in the environment is switched by status and may not declare this key.
Execution identity for the run: system = elevated (bypasses RLS) — system flows keep system privileges; after an approval decision their attribution user is the decider; user = the human whose act is running this segment: the trigger user until a human decision, the decider after it (RLS-respecting; the nodes after an approval decision run with the decider's identity and permissions, so a node the decider may not perform is refused). Elevation does not reach identity assignment: a system run's governed writes (insert, update, delete, transfer, restore, purge) to sys_user_position, sys_user_permission_set, sys_invitation and sys_member are refused with PERMISSION_DENIED; declare user for position holdings and permission-set grants (the ADR-0090 D12 delegated-administration gate then judges the user the run acts for), and change invitations and memberships through the organization endpoints. Nor does it reach a ledger: a system run's update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' (the audit log, the activity feed and their siblings) is refused with PERMISSION_DENIED, and so is its delete of a record such a ledger row references, because that delete would change the ledger row; an insert is not judged by this rule. Nor does it lift the organization wall: a system run for a user has its reads and writes judged by that user's organization wall. A write whose own data names an organization outside it, or empties a record's organization, is refused with PERMISSION_DENIED. Where the wall denies the user (no active organization under isolated, no membership under group), its reads of an organization's records return none, its deletes remove none, and its other writes are refused with PERMISSION_DENIED. A run that began for no caller is not judged by it, after an approval decision too. A run with no trigger user has no identity to scope to, so under user its data operations are REFUSED — declare system to make the elevation explicit. This covers schedule/time-relative/api triggers AND any record-change flow fired by a write that carried no user. Except behind an anonymous door: publish refuses system on a flow that an authRequired: false endpoint of type flow triggers (ADR-0138 D2b); serve that caller through an authenticated endpoint, the flow's signed inbound hook, or a public form.
requiredPermissions
string[]
optional
[ADR-0066 D4] Capabilities required to START this flow, the flow-level twin of an action's requiredPermissions. Checked at every door that starts a flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow): a caller that is not the system principal must hold every named capability, or the door answers 403 PERMISSION_DENIED and nothing runs. An action that starts this flow inherits the list even when it declares none; one that declares its own needs both. A parent flow's subflow node is not a door and is not checked again. Use this, not current_user.positions inside the flow, to say who may start an elevated (runAs: system) screen or api flow.
Flow-level error handling configuration. A durable pause ends the retry-governed segment: strategy: 'retry' describes one synchronous dispatch, so a run that parks on an approval/screen/wait node and later resumes gets one attempt for anything that fails after the pause. Protect the post-pause half with its own failure handling in the flow — a try_catch node's retry around the post-resume work, or fault edges to a handler node.
Human-readable reason shown when a write is refused by _lock.
_lockSource
Enum<'artifact' | 'package' | 'env-forced'>
optional
Layer that set _lock (artifact | package | env-forced).
_provenance
Enum<'package' | 'org' | 'env-forced'>
optional
Origin of the item (package | org | env-forced).
_packageId
string
optional
Owning package machine id.
_packageVersion
string
optional
Owning package version.
_lockDocsUrl
string
optional
Optional documentation link surfaced next to _lockReason.
overrides
{ package: string; basedOn: string }
optional
Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.
Variable name — a name without a leading $ (the $ names are the flow engine's own), read as {{ name }}
type
string
✅
Data type (text, number, boolean, object, list)
isInput
boolean
optional (default: false)
Is input parameter
isOutput
boolean
optional (default: false)
Is output parameter
defaultValue
any
optional
Value bound at run start when no parameter supplies one — this is what makes a declared variable always bound. An explicitly supplied param wins, including false and null; the boundary is params[name] !== undefined.
objectName
string
optional
Declares this input a record reference: its value is the id of one record of the named object (the object's snake_case name, e.g. crm_account). Only on an input (isInput: true). The contract: every door that starts the flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow) loads a declared input from this object in the caller's own scope before the run exists; an id the caller cannot read there is refused 404 RECORD_NOT_FOUND, and a value that is not an id is refused 400 naming the input. The load is added beside any read the flow's own definition makes of the input, never in place of one. An input without this declaration is judged as a record only where the flow's own definition reads it as a record id. type stays the data type: the variable holds the id the caller sent.
Action type — a built-in FlowNodeAction id or a plugin-registered node type. Validated against the live action registry at registerFlow() (ADR-0018), not by a closed enum. The retired callout names 'http_request', 'http_call' and 'webhook' are reserved and refused: use 'http'.
Configuration for wait node event resumption. REQUIRED on a type: 'wait' node — the block is the whole contract, and a wait node without one parses into a run that parks forever reporting success. Under eventType: 'timer' a timerDuration is required too.
Configuration for boundary events attached to host nodes. REQUIRED on a type: 'boundary_event' node — without it the node names neither the activity it watches nor what fires it.
Predicate (CEL) returning boolean used for branching. An evaluated slot: a bare non-blank CEL string, or an envelope carrying a non-blank source — an ast-only envelope, and a source that is blank after trimming, are refused at authoring because the engine evaluates source alone and would otherwise answer a silent false.
Connection type: default (normal flow), fault (error path), conditional (expression-guarded), or back (ADR-0044 declared back-edge — traversed normally at run time, but excluded from DAG cycle validation so a revise/rework loop can re-enter an earlier node)
label
string
optional
Label on the connector
isDefault
boolean
optional (default: false)
BPMN default flow: traverse this edge only when no sibling conditional edge of the same source node matched. Mutually exclusive with condition; at most one per source node.
How to handle node execution errors. 'retry' governs ONE synchronous dispatch: a durable pause (approval/screen/wait) ends the retry-governed segment, so a failure after the run resumes is not retried.
maxRetries
integer
optional (default: 0)
Retry attempts after the initial one. Read only under strategy: 'retry', which requires >= 1; 0 (the default) means no retry.
backoffMs
integer
optional (default: 1000)
Base delay before the first retry (ms); subsequent delays multiply by backoffMultiplier
backoffMultiplier
number
optional (default: 1)
Exponential backoff multiplier; 1 (the default) keeps the delay flat
maxRetryDelayMs
integer
optional (default: 30000)
Ceiling for a single backoff delay (ms)
jitter
boolean
optional (default: false)
Randomize each delay within [50%, 100%] of its computed value — spreads a thundering herd of simultaneous retries
The base package id whose same-named item this item replaces whole (e.g. "com.acme.crm"). Only an item of the base's paired "<base>.custom" package declares an override.
basedOn
string
✅
Recorded, never a gate: the base package's manifest.version this override was taken from (e.g. "3.2.0"), not a history version of the item. Nothing is refused, merged or rebased on it; it tells a person re-basing the override where it started. One reader, as advice: a base's upgrade plan lists an override whose basedOn is not the installed base version as stale, beside each override whose base item the upgrade changes (ADR-0146 D2, as amended).
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Text for a terminal success, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of a generic "Done". A {{ }} template over the run's variables ({{ enrolledCount }} contacts enrolled), rendered when the run completes.
errorMessage
string
optional
Text for a terminal failure, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of the raw error. A {{ }} template over the run's variables, rendered over the variables at the failure point.
version
integer
optional (default: 1)
Version number
status
Enum<'draft' | 'active' | 'obsolete' | 'invalid'>
optional (default: "draft")
Deployment status
defaultActive
boolean
optional
Packaged flows only: false ships the flow switched off, so it is not armed on an installation until an administrator turns it on with the packaged-flow switch (the activation ledger); the administrator's choice, once made, wins over this default across restarts and upgrades. Absent or true: switched on. status stays the author's switch: obsolete/invalid disarm the flow everywhere. A flow authored in the environment is switched by status and may not declare this key.
Execution identity for the run: system = elevated (bypasses RLS) — system flows keep system privileges; after an approval decision their attribution user is the decider; user = the human whose act is running this segment: the trigger user until a human decision, the decider after it (RLS-respecting; the nodes after an approval decision run with the decider's identity and permissions, so a node the decider may not perform is refused). Elevation does not reach identity assignment: a system run's governed writes (insert, update, delete, transfer, restore, purge) to sys_user_position, sys_user_permission_set, sys_invitation and sys_member are refused with PERMISSION_DENIED; declare user for position holdings and permission-set grants (the ADR-0090 D12 delegated-administration gate then judges the user the run acts for), and change invitations and memberships through the organization endpoints. Nor does it reach a ledger: a system run's update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' (the audit log, the activity feed and their siblings) is refused with PERMISSION_DENIED, and so is its delete of a record such a ledger row references, because that delete would change the ledger row; an insert is not judged by this rule. Nor does it lift the organization wall: a system run for a user has its reads and writes judged by that user's organization wall. A write whose own data names an organization outside it, or empties a record's organization, is refused with PERMISSION_DENIED. Where the wall denies the user (no active organization under isolated, no membership under group), its reads of an organization's records return none, its deletes remove none, and its other writes are refused with PERMISSION_DENIED. A run that began for no caller is not judged by it, after an approval decision too. A run with no trigger user has no identity to scope to, so under user its data operations are REFUSED — declare system to make the elevation explicit. This covers schedule/time-relative/api triggers AND any record-change flow fired by a write that carried no user. Except behind an anonymous door: publish refuses system on a flow that an authRequired: false endpoint of type flow triggers (ADR-0138 D2b); serve that caller through an authenticated endpoint, the flow's signed inbound hook, or a public form.
requiredPermissions
string[]
optional
[ADR-0066 D4] Capabilities required to START this flow, the flow-level twin of an action's requiredPermissions. Checked at every door that starts a flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow): a caller that is not the system principal must hold every named capability, or the door answers 403 PERMISSION_DENIED and nothing runs. An action that starts this flow inherits the list even when it declares none; one that declares its own needs both. A parent flow's subflow node is not a door and is not checked again. Use this, not current_user.positions inside the flow, to say who may start an elevated (runAs: system) screen or api flow.
Flow-level error handling configuration. A durable pause ends the retry-governed segment: strategy: 'retry' describes one synchronous dispatch, so a run that parks on an approval/screen/wait node and later resumes gets one attempt for anything that fails after the pause. Protect the post-pause half with its own failure handling in the flow — a try_catch node's retry around the post-resume work, or fault edges to a handler node.
Human-readable reason shown when a write is refused by _lock.
_lockSource
Enum<'artifact' | 'package' | 'env-forced'>
optional
Layer that set _lock (artifact | package | env-forced).
_provenance
Enum<'package' | 'org' | 'env-forced'>
optional
Origin of the item (package | org | env-forced).
_packageId
string
optional
Owning package machine id.
_packageVersion
string
optional
Owning package version.
_lockDocsUrl
string
optional
Optional documentation link surfaced next to _lockReason.
overrides
{ package: string; basedOn: string }
optional
Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
The flow author's own failure text (flow.errorMessage, rendered by the engine), copied verbatim from AutomationResult.errorMessage; absent when the author wrote none
The refusal a node met inside the run (a data node's read or write, or a script node's function resolution; AutomationResult.innerRefusal): { code, message }, code in its wire spelling (e.g. UNIQUE_VIOLATION). Absent when the failure met no refusal
Total records written / effects dispatched by the run
skipped
integer
✅
Total node executions a closed gate prevented
unmeasured
integer
optional
Total executions that may have caused an effect the platform cannot count. Absent = not tracked (an older run), which is not the same as zero.
failed
integer
optional
Total node executions that failed — a fold of nodes[].failures, INCLUDING what a delegating node (subflow / map) rolled up from a child run that COMPLETED while containing failures: this total answers "what did this run cause", subflows included, so a parent whose child lost rows does not read failed: 0. A child that FAILED — whether or not it also contained failures before it failed — counts once, as the delegating step's own failure, and its own failed stays on its row (unlike acted, which carries a failed child's writes). On a run that completed every one of them was contained (caught by a try_catch or routed down a fault edge) and the run went on. Absent = not tracked (an older run), which is not the same as zero.
Gates that closed during the run, most-skipped first
detailOmitted
boolean
optional
Set when persistence dropped nodes/gates to keep the stored row bounded — the totals are still exact. Declared so empty arrays are never mistaken for "nothing ran".
The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in error.code (e.g. UNIQUE_VIOLATION); the closed set ApiErrorSchema.code parses against
message
string
✅
The inner refusal's own diagnostic text, verbatim, without the node and operation prefixes the run's failure text adds
The inner refusal's code in its WIRE spelling - the ADR-0112 member a record save of the same write answers in error.code (e.g. UNIQUE_VIOLATION); the closed set ApiErrorSchema.code parses against
message
string
✅
The inner refusal's own diagnostic text, verbatim, without the node and operation prefixes the run's failure text adds
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Text for a terminal success, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of a generic "Done". A {{ }} template over the run's variables ({{ enrolledCount }} contacts enrolled), rendered when the run completes.
errorMessage
string
optional
Text for a terminal failure, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of the raw error. A {{ }} template over the run's variables, rendered over the variables at the failure point.
version
integer
optional (default: 1)
Version number
status
Enum<'draft' | 'active' | 'obsolete' | 'invalid'>
optional (default: "draft")
Deployment status
defaultActive
boolean
optional
Packaged flows only: false ships the flow switched off, so it is not armed on an installation until an administrator turns it on with the packaged-flow switch (the activation ledger); the administrator's choice, once made, wins over this default across restarts and upgrades. Absent or true: switched on. status stays the author's switch: obsolete/invalid disarm the flow everywhere. A flow authored in the environment is switched by status and may not declare this key.
Execution identity for the run: system = elevated (bypasses RLS) — system flows keep system privileges; after an approval decision their attribution user is the decider; user = the human whose act is running this segment: the trigger user until a human decision, the decider after it (RLS-respecting; the nodes after an approval decision run with the decider's identity and permissions, so a node the decider may not perform is refused). Elevation does not reach identity assignment: a system run's governed writes (insert, update, delete, transfer, restore, purge) to sys_user_position, sys_user_permission_set, sys_invitation and sys_member are refused with PERMISSION_DENIED; declare user for position holdings and permission-set grants (the ADR-0090 D12 delegated-administration gate then judges the user the run acts for), and change invitations and memberships through the organization endpoints. Nor does it reach a ledger: a system run's update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' (the audit log, the activity feed and their siblings) is refused with PERMISSION_DENIED, and so is its delete of a record such a ledger row references, because that delete would change the ledger row; an insert is not judged by this rule. Nor does it lift the organization wall: a system run for a user has its reads and writes judged by that user's organization wall. A write whose own data names an organization outside it, or empties a record's organization, is refused with PERMISSION_DENIED. Where the wall denies the user (no active organization under isolated, no membership under group), its reads of an organization's records return none, its deletes remove none, and its other writes are refused with PERMISSION_DENIED. A run that began for no caller is not judged by it, after an approval decision too. A run with no trigger user has no identity to scope to, so under user its data operations are REFUSED — declare system to make the elevation explicit. This covers schedule/time-relative/api triggers AND any record-change flow fired by a write that carried no user. Except behind an anonymous door: publish refuses system on a flow that an authRequired: false endpoint of type flow triggers (ADR-0138 D2b); serve that caller through an authenticated endpoint, the flow's signed inbound hook, or a public form.
requiredPermissions
string[]
optional
[ADR-0066 D4] Capabilities required to START this flow, the flow-level twin of an action's requiredPermissions. Checked at every door that starts a flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow): a caller that is not the system principal must hold every named capability, or the door answers 403 PERMISSION_DENIED and nothing runs. An action that starts this flow inherits the list even when it declares none; one that declares its own needs both. A parent flow's subflow node is not a door and is not checked again. Use this, not current_user.positions inside the flow, to say who may start an elevated (runAs: system) screen or api flow.
Flow-level error handling configuration. A durable pause ends the retry-governed segment: strategy: 'retry' describes one synchronous dispatch, so a run that parks on an approval/screen/wait node and later resumes gets one attempt for anything that fails after the pause. Protect the post-pause half with its own failure handling in the flow — a try_catch node's retry around the post-resume work, or fault edges to a handler node.
Human-readable reason shown when a write is refused by _lock.
_lockSource
Enum<'artifact' | 'package' | 'env-forced'>
optional
Layer that set _lock (artifact | package | env-forced).
_provenance
Enum<'package' | 'org' | 'env-forced'>
optional
Origin of the item (package | org | env-forced).
_packageId
string
optional
Owning package machine id.
_packageVersion
string
optional
Owning package version.
_lockDocsUrl
string
optional
Optional documentation link surfaced next to _lockReason.
overrides
{ package: string; basedOn: string }
optional
Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Per-run rollup: records selected / acted on, gate skips, per-node status
variables
Record<string, any>
optional
Final state of flow variables
startedAt
string
✅
Execution start timestamp
completedAt
string
optional
Execution completion timestamp
durationMs
integer
optional
Total execution duration in milliseconds
waitMs
integer
optional
Total time the run spent suspended (waiting at a screen, approval, wait or other pausing node), summed over all its pauses, in milliseconds. Included in durationMs, which stays the total wall time, so the time spent executing is durationMs - waitMs. 0 on a run that never paused; on a paused entry, the wait up to the moment the entry was written. Absent when not recorded — a missed entry, or a run paused before this was tracked — which is not the same as zero.
[REMOVED] cursor was removed from GET /api/v1/automation/:name/runs in @objectstack/spec 17.5.0 (ADR-0049 enforce-or-remove) — it was VALIDATED at the boundary and then read by nothing: the option reached the service and the engine never looked at it, no emit site has ever written the response half nextCursor, and the only ordering this door has is a required but non-unique startedAt timestamp that nothing ever minted a resume point from — so a caller looping "until the cursor runs out" re-read the first and only window forever, with no error. Delete the key. limit is the real window and STAYS: it is read end to end (boundary to service to store) and bounded to 1..100, so ask for a wider window instead of a next page. Read the response hasMore to learn whether the window was short — it is now COMPUTED from the engine rather than the constant false it used to be.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Whether more runs matched than this response carries — widen limit to see them. Under status, false means no further match within the scanned window rather than none at all: the window is taken before the filter is applied.
The proposed update: each field it sets and its new value, keyed by the field's machine name. Every key must be a declared field of object; the door refuses any other key 400 VALIDATION_FAILED before the engine is asked. The record's other fields are read as stored.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
The run the resume was addressed to - the run that failed, and on the stranded arm the run an operator verb can re-arm. Named so a caller acts on an identifier instead of parsing one out of the message
status
Enum<'failed' | 'stranded'>
optional
The engine's own lifecycle verdict for the run, forwarded verbatim when the producer stamped one and never synthesised by the door - absent when the engine reported no status (a subflow child that failed terminally, an engine that predates the discriminator). stranded is the terminally-failed-but-repairable run of AutomationResult.status; failed says the run ran and was rejected. These two terminal-failure members of that union are the only ones that can reach a 400
repairable
boolean
✅
Whether the engine says this run can still be re-armed by an operator verb. Answered from the engine, two ways, and never from the message text: where the engine stamped a status, that word decides (stranded is the run whose OWN pause a resume consumed before a downstream node threw); where it stamped none, the door asks the engine's read-only inspection (IAutomationService.inspectConsumedSuspension) and relays its verdict. The second half is not a fallback but the honest answer for a real exit: a subflow DELEGATION failure carries no status, because nothing re-arms an ancestor by resuming it, and yet the ancestor's consumed pause is journalled and the restore verb re-arms that chain as one unit. Always present on this arm: an absent member would be indistinguishable from a server that predates this field. Every way of not getting an answer is fail-closed - a service that declares no inspection member, and a store the inspection could not read - because promising a repair verb that will refuse is worse than promising nothing
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Machine-readable failure classification, set alongside error when the caller must distinguish WHY it failed. A closed union - the members and their transport mappings are documented on the contract (AutomationResult.code, contracts/automation-service.ts).
Lifecycle status. paused means the run suspended at a node and can be continued with the resume route. Absent or completed/failed/stranded/refused means the run reached a terminal state. refused is a first-class refusal: the flow reached an end node declaring outcome: 'refused' — a successful evaluation that said no, so success is true, successMessage is absent and the per-record reason is on refusalMessage; a runner shows it with Close only. stranded is the terminally-failed-but-repairable run: a resume consumed the suspension and a downstream node threw, so the run is recorded as failed and can be re-armed only by an explicit operator verb - never by the resume route, which answers RUN_NOT_FOUND for it.
runId
string
optional
Run id - set when status is paused, so callers can resume it
The screen to render - set when the run paused at a screen node awaiting user input. The client collects values for screen.fields and resumes the run with them.
successMessage
string
optional
Friendly terminal message rendered from the flow definition on terminal success (its {{ }} holes filled over the run's variables, in the run's locale), so a screen-flow runner can show a meaningful toast
errorMessage
string
optional
Friendly terminal message rendered from the flow definition on failure (its {{ }} holes filled over the variables at the failure point, in the run's locale)
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, of the refusal a node met inside the run - present exactly when that refusal's producer opted in at throw time (ApiErrorSchema.userMessage semantics). Never replaces error
The refusal a node met inside the run (a data node's read or write, or a script node's function resolution), structured: { code, message }, code in its wire spelling. Set on a failed run only when a refusal was met; code above and error are unchanged by it
flowLabel
string
optional
The flow definition's authored label, copied verbatim so a runner can name the flow (header, completion toast) and translate it against flows.<flow>.label. Set on every result of an evaluation of a registered flow (paused and terminal alike); absent on a refusal carrying code. For a subflow chain it is the addressed (parent) run's flow. Never defaulted to the API name
refusalMessage
string
optional
Rendered refusal, set when status is refused - the end node's message template interpolated against the run's variables, so it names the record. Authored per-record text (not a flow-level copy like the two above); absent on every other status. A runner shows it with Close only
Caller-supplied field values a write step of the run did not store (e.g. a readonly field an update_record step wrote): the data engine's own drop events, one per object and reason in first-seen order; a field named means at least one write dropped it, not every write. The steps still succeeded and the run's outcome is unchanged - this tells the caller which values never landed. Set on a terminal success only, and only when a field was dropped. Delegated writes roll up here too: a subflow child's run and each map item's run, whether it completed without pausing or paused and resumed. A child run that failed answers no drops, so where a try_catch or fault edge contains that failure an absent member is not proof the failed child dropped nothing. A map item whose paused run an operator cancelled answers none either (its slot in results holds the cancelled marker).
Text for a terminal success, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of a generic "Done". A {{ }} template over the run's variables ({{ enrolledCount }} contacts enrolled), rendered when the run completes.
errorMessage
string
optional
Text for a terminal failure, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of the raw error. A {{ }} template over the run's variables, rendered over the variables at the failure point.
version
integer
optional (default: 1)
Version number
status
Enum<'draft' | 'active' | 'obsolete' | 'invalid'>
optional (default: "draft")
Deployment status
defaultActive
boolean
optional
Packaged flows only: false ships the flow switched off, so it is not armed on an installation until an administrator turns it on with the packaged-flow switch (the activation ledger); the administrator's choice, once made, wins over this default across restarts and upgrades. Absent or true: switched on. status stays the author's switch: obsolete/invalid disarm the flow everywhere. A flow authored in the environment is switched by status and may not declare this key.
Execution identity for the run: system = elevated (bypasses RLS) — system flows keep system privileges; after an approval decision their attribution user is the decider; user = the human whose act is running this segment: the trigger user until a human decision, the decider after it (RLS-respecting; the nodes after an approval decision run with the decider's identity and permissions, so a node the decider may not perform is refused). Elevation does not reach identity assignment: a system run's governed writes (insert, update, delete, transfer, restore, purge) to sys_user_position, sys_user_permission_set, sys_invitation and sys_member are refused with PERMISSION_DENIED; declare user for position holdings and permission-set grants (the ADR-0090 D12 delegated-administration gate then judges the user the run acts for), and change invitations and memberships through the organization endpoints. Nor does it reach a ledger: a system run's update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' (the audit log, the activity feed and their siblings) is refused with PERMISSION_DENIED, and so is its delete of a record such a ledger row references, because that delete would change the ledger row; an insert is not judged by this rule. Nor does it lift the organization wall: a system run for a user has its reads and writes judged by that user's organization wall. A write whose own data names an organization outside it, or empties a record's organization, is refused with PERMISSION_DENIED. Where the wall denies the user (no active organization under isolated, no membership under group), its reads of an organization's records return none, its deletes remove none, and its other writes are refused with PERMISSION_DENIED. A run that began for no caller is not judged by it, after an approval decision too. A run with no trigger user has no identity to scope to, so under user its data operations are REFUSED — declare system to make the elevation explicit. This covers schedule/time-relative/api triggers AND any record-change flow fired by a write that carried no user. Except behind an anonymous door: publish refuses system on a flow that an authRequired: false endpoint of type flow triggers (ADR-0138 D2b); serve that caller through an authenticated endpoint, the flow's signed inbound hook, or a public form.
requiredPermissions
string[]
optional
[ADR-0066 D4] Capabilities required to START this flow, the flow-level twin of an action's requiredPermissions. Checked at every door that starts a flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow): a caller that is not the system principal must hold every named capability, or the door answers 403 PERMISSION_DENIED and nothing runs. An action that starts this flow inherits the list even when it declares none; one that declares its own needs both. A parent flow's subflow node is not a door and is not checked again. Use this, not current_user.positions inside the flow, to say who may start an elevated (runAs: system) screen or api flow.
Flow-level error handling configuration. A durable pause ends the retry-governed segment: strategy: 'retry' describes one synchronous dispatch, so a run that parks on an approval/screen/wait node and later resumes gets one attempt for anything that fails after the pause. Protect the post-pause half with its own failure handling in the flow — a try_catch node's retry around the post-resume work, or fault edges to a handler node.
Human-readable reason shown when a write is refused by _lock.
_lockSource
Enum<'artifact' | 'package' | 'env-forced'>
optional
Layer that set _lock (artifact | package | env-forced).
_provenance
Enum<'package' | 'org' | 'env-forced'>
optional
Origin of the item (package | org | env-forced).
_packageId
string
optional
Owning package machine id.
_packageVersion
string
optional
Owning package version.
_lockDocsUrl
string
optional
Optional documentation link surfaced next to _lockReason.
overrides
{ package: string; basedOn: string }
optional
Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.
Error code (e.g. VALIDATION_ERROR; StandardErrorCode ∪ the ledger the serving side registers — ERROR_CODE_LEDGER for framework packages)
declaredCode
string
optional
The producer-declared code, verbatim, when it is not a member of the closed code vocabulary — the open, author-authored channel (app-specific spellings; ADR-0112)
message
string
✅
Readable error message
userMessage
string
optional
Producer-marked user-facing refusal text, verbatim, in the request's locale: platform-composed text falls back to the workspace default locale, then en; an app-authored refusal falls back to its declared wording. Present exactly when the producer opted in at throw time; consumers render it to end users as received and keep their generic substitution for anything unmarked. Status-agnostic; never replaces message.
refusal
true
optional
Producer-declared: the 5xx this envelope carries is a deliberate refusal whose message is authored for the caller, so a boundary that reads the declaration keeps it verbatim (until the withhold arms read it, a declared refusal is still withheld). Absent (the default) on a declared fault, whose message is withheld from the body and logged for the operator; redundant on a 4xx. Presence is the declaration — true is the only value.
category
string
optional
Error category (e.g. validation, authorization)
httpStatus
integer
optional
HTTP status of the response carrying this error
details
any
optional
Additional error context (e.g. field validation errors)
Text for a terminal success, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of a generic "Done". A {{ }} template over the run's variables ({{ enrolledCount }} contacts enrolled), rendered when the run completes.
errorMessage
string
optional
Text for a terminal failure, carried on AutomationResult for every terminal run (not only screen flows); the screen-flow UI shows it as a toast instead of the raw error. A {{ }} template over the run's variables, rendered over the variables at the failure point.
version
integer
optional (default: 1)
Version number
status
Enum<'draft' | 'active' | 'obsolete' | 'invalid'>
optional (default: "draft")
Deployment status
defaultActive
boolean
optional
Packaged flows only: false ships the flow switched off, so it is not armed on an installation until an administrator turns it on with the packaged-flow switch (the activation ledger); the administrator's choice, once made, wins over this default across restarts and upgrades. Absent or true: switched on. status stays the author's switch: obsolete/invalid disarm the flow everywhere. A flow authored in the environment is switched by status and may not declare this key.
Execution identity for the run: system = elevated (bypasses RLS) — system flows keep system privileges; after an approval decision their attribution user is the decider; user = the human whose act is running this segment: the trigger user until a human decision, the decider after it (RLS-respecting; the nodes after an approval decision run with the decider's identity and permissions, so a node the decider may not perform is refused). Elevation does not reach identity assignment: a system run's governed writes (insert, update, delete, transfer, restore, purge) to sys_user_position, sys_user_permission_set, sys_invitation and sys_member are refused with PERMISSION_DENIED; declare user for position holdings and permission-set grants (the ADR-0090 D12 delegated-administration gate then judges the user the run acts for), and change invitations and memberships through the organization endpoints. Nor does it reach a ledger: a system run's update, transfer, delete, purge or restore of an object declared managedBy: 'append-only' (the audit log, the activity feed and their siblings) is refused with PERMISSION_DENIED, and so is its delete of a record such a ledger row references, because that delete would change the ledger row; an insert is not judged by this rule. Nor does it lift the organization wall: a system run for a user has its reads and writes judged by that user's organization wall. A write whose own data names an organization outside it, or empties a record's organization, is refused with PERMISSION_DENIED. Where the wall denies the user (no active organization under isolated, no membership under group), its reads of an organization's records return none, its deletes remove none, and its other writes are refused with PERMISSION_DENIED. A run that began for no caller is not judged by it, after an approval decision too. A run with no trigger user has no identity to scope to, so under user its data operations are REFUSED — declare system to make the elevation explicit. This covers schedule/time-relative/api triggers AND any record-change flow fired by a write that carried no user. Except behind an anonymous door: publish refuses system on a flow that an authRequired: false endpoint of type flow triggers (ADR-0138 D2b); serve that caller through an authenticated endpoint, the flow's signed inbound hook, or a public form.
requiredPermissions
string[]
optional
[ADR-0066 D4] Capabilities required to START this flow, the flow-level twin of an action's requiredPermissions. Checked at every door that starts a flow by name (the trigger route, an action of type flow over REST and MCP run_action, a declared endpoint of type flow): a caller that is not the system principal must hold every named capability, or the door answers 403 PERMISSION_DENIED and nothing runs. An action that starts this flow inherits the list even when it declares none; one that declares its own needs both. A parent flow's subflow node is not a door and is not checked again. Use this, not current_user.positions inside the flow, to say who may start an elevated (runAs: system) screen or api flow.
Flow-level error handling configuration. A durable pause ends the retry-governed segment: strategy: 'retry' describes one synchronous dispatch, so a run that parks on an approval/screen/wait node and later resumes gets one attempt for anything that fails after the pause. Protect the post-pause half with its own failure handling in the flow — a try_catch node's retry around the post-resume work, or fault edges to a handler node.
Human-readable reason shown when a write is refused by _lock.
_lockSource
Enum<'artifact' | 'package' | 'env-forced'>
optional
Layer that set _lock (artifact | package | env-forced).
_provenance
Enum<'package' | 'org' | 'env-forced'>
optional
Origin of the item (package | org | env-forced).
_packageId
string
optional
Owning package machine id.
_packageVersion
string
optional
Owning package version.
_lockDocsUrl
string
optional
Optional documentation link surfaced next to _lockReason.
overrides
{ package: string; basedOn: string }
optional
Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.