Skip to content

Latest commit

 

History

History
1346 lines (1117 loc) · 103 KB

automation-api.mdx

File metadata and controls

1346 lines (1117 loc) · 103 KB
title Automation Api schema — API Protocol reference
navTitle Automation Api
description Defines REST CRUD endpoint schemas for managing automation flows, triggering executions, and querying execution history.

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

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 flow
POST   /api/v1/automation                      — Create flow
PUT    /api/v1/automation/:name                — Update flow
DELETE /api/v1/automation/:name                — Delete flow
POST   /api/v1/automation/:name/trigger        — Trigger flow execution
POST   /api/v1/automation/:name/toggle         — Enable/disable a packaged flow
POST   /api/v1/automation/:name/clone          — Copy a flow, switched off, into a package
GET    /api/v1/automation/:name/runs           — List execution runs
GET    /api/v1/automation/:name/runs/:runId    — Get single execution run
POST   /api/v1/automation/_record-starts       — Flows a proposed record update would start
**Source:** `packages/spec/src/api/automation-api.zod.ts`

TypeScript Usage

import { AutomationApiErrorCode, AutomationFlowPathParamsSchema, AutomationRunPathParamsSchema, CloneFlowRequestSchema, CloneFlowResponseSchema, CreateFlowRequestSchema, CreateFlowResponseSchema, DeleteFlowRequestSchema, DeleteFlowResponseSchema, FlowFailureDetailsSchema, FlowInnerRefusalSchema, GetFlowRequestSchema, GetFlowResponseSchema, GetRunRequestSchema, GetRunResponseSchema, ListRunsRequestSchema, ListRunsResponseSchema, RecordUpdateStartSchema, RecordUpdateStartsRequestSchema, RecordUpdateStartsResponseSchema, ResumeFailureDetailsSchema, ToggleFlowRequestSchema, ToggleFlowResponseSchema, TriggerFlowRequestSchema, TriggerFlowResponseSchema, UpdateFlowRequestSchema, UpdateFlowResponseSchema } from '@objectstack/spec/api';
import type { AutomationApiErrorCode, AutomationFlowPathParams, AutomationRunPathParams, CloneFlowRequest, CloneFlowResponse, CreateFlowRequest, CreateFlowResponse, DeleteFlowRequest, DeleteFlowResponse, FlowFailureDetails, FlowInnerRefusal, GetFlowRequest, GetFlowResponse, GetRunRequest, GetRunResponse, ListRunsRequest, ListRunsResponse, RecordUpdateStart, RecordUpdateStartsRequest, RecordUpdateStartsResponse, ResumeFailureDetails, ToggleFlowRequest, ToggleFlowResponse, TriggerFlowRequest, TriggerFlowResponse, UpdateFlowRequest, UpdateFlowResponse } from '@objectstack/spec/api';

// Validate data
const result = AutomationApiErrorCode.parse(data);

AutomationApiErrorCode

Allowed Values

  • flow_not_found
  • flow_already_exists
  • flow_validation_failed
  • flow_disabled
  • execution_not_found
  • execution_failed
  • execution_timeout
  • node_executor_not_found
  • concurrent_execution_limit

AutomationFlowPathParams

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)

AutomationRunPathParams

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
runId string ✅ Execution run ID

CloneFlowRequest

Properties

Property Type Required Description
name string ✅ 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.

CloneFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { flow: object; packageId: string; notice: string; noticeCode?: string } ✅

Nested Shape: CloneFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: CloneFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: CloneFlowResponse.data

Property Type Required Description
flow { name: string; label: string; description?: string; successMessage?: string; … } ✅ 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.

CreateFlowRequest

Properties

Property Type Required Description
name string ✅ Machine name
label string ✅ Flow label
description string optional
successMessage string optional 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.
type Enum<'autolaunched' | 'record_change' | 'schedule' | 'screen' | 'api'> ✅ Flow type
variables { name: string; type: string; isInput?: boolean; isOutput?: boolean; … }[] optional Flow variables
nodes { id: string; type: string; label: string; config?: Record<string, any>; … }[] ✅ Flow nodes
edges { id: string; source: string; target: string; condition?: string | object; … }[] ✅ Flow connections
runAs Enum<'system' | 'user'> optional (default: "user") 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. 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.
errorHandling { strategy?: Enum<'fail' | 'retry' | 'continue'>; maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number; … } optional 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.
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this flow.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional 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.

Nested Shape: CreateFlowRequest.variables[number]

Property Type Required Description
name string ✅ 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.

Nested Shape: CreateFlowRequest.nodes[number]

Property Type Required Description
id string ✅ Node unique ID
type string ✅ 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'.
label string ✅ Node label
config Record<string, any> optional Node configuration
connectorConfig { connectorId: string; actionId: string; input?: Record<string, any> } optional
position { x: number; y: number } optional
timeoutMs integer optional Maximum execution time for this node in milliseconds
inputSchema Record<string, { type: Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>; required?: boolean; description?: string }> optional Input parameter schema for this node
waitEventConfig { eventType: Enum<'timer' | 'signal' | 'webhook' | 'manual' | 'condition'>; timerDuration?: string; signalName?: string } optional 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.
boundaryConfig { attachedToNodeId: string; eventType: Enum<'error' | 'timer' | 'signal' | 'cancel'>; interrupting?: boolean; errorCode?: string; … } optional 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.

Nested Shape: CreateFlowRequest.edges[number]

Property Type Required Description
id string ✅ Edge unique ID
source string ✅ Source Node ID
target string ✅ Target Node ID
condition string | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object } optional 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.
type Enum<'default' | 'fault' | 'conditional' | 'back'> optional (default: "default") 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.

Nested Shape: CreateFlowRequest.errorHandling

Property Type Required Description
strategy Enum<'fail' | 'retry' | 'continue'> optional (default: "fail") 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

Nested Shape: CreateFlowRequest.protection

Property Type Required Description
lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> ✅ Lock policy — none | no-overlay | no-delete | full.
reason string ✅ User-visible reason shown when the lock blocks an action.
docsUrl string optional Optional URL the Studio banner links to for more context.

Nested Shape: CreateFlowRequest.overrides

Property Type Required Description
package string ✅ 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).

CreateFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { name: string; label: string; description?: string; successMessage?: string; … } ✅ The created flow, canonicalized — the parsed shape the engine stored, identical to what a subsequent GET answers

Nested Shape: CreateFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: CreateFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: CreateFlowResponse.data

Property Type Required Description
name string ✅ Machine name
label string ✅ Flow label
description string optional
successMessage string optional 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.
type Enum<'autolaunched' | 'record_change' | 'schedule' | 'screen' | 'api'> ✅ Flow type
variables { name: string; type: string; isInput?: boolean; isOutput?: boolean; … }[] optional Flow variables
nodes { id: string; type: string; label: string; config?: Record<string, any>; … }[] ✅ Flow nodes
edges { id: string; source: string; target: string; condition?: string | object; … }[] ✅ Flow connections
runAs Enum<'system' | 'user'> optional (default: "user") 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. 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.
errorHandling { strategy?: Enum<'fail' | 'retry' | 'continue'>; maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number; … } optional 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.
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this flow.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional 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.

DeleteFlowRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)

DeleteFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { name: string; deleted: boolean } ✅

Nested Shape: DeleteFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: DeleteFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: DeleteFlowResponse.data

Property Type Required Description
name string ✅ Name of the deleted flow
deleted boolean ✅ Whether the flow was deleted

FlowFailureDetails

Properties

Property Type Required Description
errorMessage string optional The flow author's own failure text (flow.errorMessage, rendered by the engine), copied verbatim from AutomationResult.errorMessage; absent when the author wrote none
summary { selected: integer; acted: integer; skipped: integer; unmeasured?: integer; … } optional The run's per-node accounting (AutomationResult.summary) - which node failed; absent when the engine measured none
innerRefusal { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; message: string } optional 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

Nested Shape: FlowFailureDetails.summary

Property Type Required Description
selected integer ✅ Total records read by the run
acted integer ✅ 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.
nodes { nodeId: string; nodeType: string; nodeLabel?: string; status: Enum<'success' | 'failure' | 'skipped'>; … }[] ✅ Per-node breakdown, in first-execution order
gates { nodeId: string; targetNodeId: string; edgeId?: string; label?: string; … }[] ✅ 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".

Nested Shape: FlowFailureDetails.innerRefusal

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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

FlowInnerRefusal

Properties

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | 'INVALID_FORMAT' | 'VALUE_TOO_LONG' | 'VALUE_TOO_SHORT' | 'VALUE_OUT_OF_RANGE' | … +378 more> ✅ 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

Allowed Values: FlowInnerRefusal.code

  • VALIDATION_ERROR
  • INVALID_FIELD
  • MISSING_REQUIRED_FIELD
  • INVALID_FORMAT
  • VALUE_TOO_LONG
  • VALUE_TOO_SHORT
  • VALUE_OUT_OF_RANGE
  • INVALID_REFERENCE
  • DUPLICATE_VALUE
  • INVALID_QUERY
  • INVALID_FILTER
  • INVALID_SORT
  • MAX_RECORDS_EXCEEDED
  • UNAUTHENTICATED
  • INVALID_CREDENTIALS
  • EXPIRED_TOKEN
  • INVALID_TOKEN
  • SESSION_EXPIRED
  • MFA_REQUIRED
  • EMAIL_NOT_VERIFIED
  • PERMISSION_DENIED
  • INSUFFICIENT_PRIVILEGES
  • FIELD_NOT_ACCESSIBLE
  • RECORD_NOT_ACCESSIBLE
  • LICENSE_REQUIRED
  • IP_RESTRICTED
  • TIME_RESTRICTED
  • RESOURCE_NOT_FOUND
  • OBJECT_NOT_FOUND
  • RECORD_NOT_FOUND
  • FIELD_NOT_FOUND
  • ENDPOINT_NOT_FOUND
  • RESOURCE_CONFLICT
  • CONCURRENT_MODIFICATION
  • DELETE_RESTRICTED
  • DUPLICATE_RECORD
  • LOCK_CONFLICT
  • METHOD_NOT_ALLOWED
  • PRECONDITION_REQUIRED
  • RATE_LIMIT_EXCEEDED
  • QUOTA_EXCEEDED
  • INTERNAL_ERROR
  • DATABASE_ERROR
  • TIMEOUT
  • SERVICE_UNAVAILABLE
  • NOT_IMPLEMENTED
  • EXTERNAL_SERVICE_ERROR
  • INTEGRATION_ERROR
  • WEBHOOK_DELIVERY_FAILED
  • ACCESS_UPGRADE_CONFIRMATION_REQUIRED
  • ACCOUNT_LOCKED
  • ACTION_CONFIRMATION_REQUIRED
  • ACTION_DISABLED
  • ALREADY_REVERTED
  • AMBIGUOUS_MATCH
  • ANALYTICS_DATE_RANGE_UNRECOGNIZED
  • ANALYTICS_QUERY_FAILED
  • API_KEY_EXPIRED
  • API_KEY_EXPIRY_TOO_LONG
  • API_KEY_INACTIVE
  • API_KEY_REVOKED
  • APPROVAL_ACTIONS_FAILED
  • APPROVAL_APPROVE_FAILED
  • APPROVAL_COMMENT_FAILED
  • APPROVAL_REASSIGN_FAILED
  • APPROVAL_RECALL_FAILED
  • APPROVAL_REJECT_FAILED
  • APPROVAL_REMIND_FAILED
  • APPROVAL_REQUEST_GET_FAILED
  • APPROVAL_REQUEST_INFO_FAILED
  • APPROVAL_REQUEST_LIST_FAILED
  • APPROVAL_RESUBMIT_FAILED
  • APPROVAL_REVISE_FAILED
  • ASYNC_NOT_SUPPORTED
  • ATTACHMENT_DELETE_DENIED
  • ATTACHMENT_DOWNLOAD_DENIED
  • ATTACHMENT_PARENT_ACCESS
  • AUDIENCE_NOT_ALLOWED
  • AUDIT_TYPE_NOT_CANONICAL
  • AUTH_CONFIG_ERROR
  • AUTH_REQUIRED
  • AUTOMATION_UNSCOPED_RUN_DATA_ACCESS
  • BANNED_USER
  • BATCH_ABORTED
  • BATCH_NOT_ATOMIC
  • BATCH_TOO_LARGE
  • BATCH_UNRESOLVED_REF
  • BLANK_MATCH_KEY
  • CHANGE_OWNER_DISABLED
  • CLONE_DISABLED
  • CLOUD_FETCH_FAILED
  • CLOUD_UNCONFIGURED
  • COMMIT_NOT_FOUND
  • CONCURRENT_UPDATE
  • CONFLICT
  • CONFLICTING_MAPPING
  • CONNECTOR_CREDENTIAL_REJECTED
  • CONNECTOR_UPSTREAM_CHANGED
  • CONNECTOR_UPSTREAM_UNAVAILABLE
  • CREATE_FAILED
  • CREDENTIALS_NAME_DIFFERENT_ACCOUNTS
  • CUBE_NOT_FOUND
  • CYCLIC_ARTIFACT_PACKAGES
  • DATASET_INVALID
  • DATASOURCE_ADMIN_ERROR
  • DEFAULT_RECORD_PAGE_CONFLICT
  • DELEGABLE_SCOPE_FAILED
  • DELEGATION_SCOPE_VIOLATION
  • DELETE_HOOK_RESULT_NOT_WRITE_SHAPE
  • DELIVERY_NEVER_SENT
  • DELIVERY_NOT_ELIGIBLE
  • DEPENDENCY_MISSING
  • DESTRUCTIVE_CHANGE
  • DEVICE_CODE_FAILED
  • DOMAIN_VERIFICATION_DISABLED
  • DOMAIN_VERIFICATION_FAILED
  • DRIVER_UNAVAILABLE
  • DUPLICATE_ARTIFACT_OBJECT_NAME
  • DUPLICATE_ARTIFACT_PACKAGE
  • DUPLICATE_MATCH_KEY
  • DUPLICATE_REQUEST
  • DUPLICATE_SOURCE_NOT_A_BASE
  • EGRESS_ALLOWLIST_INVALID
  • EGRESS_REFUSED
  • ELIGIBILITY_UNEVALUABLE
  • EMAIL_DOMAIN_NOT_ALLOWED
  • EMAIL_SEND_FAILED
  • EMAIL_SERVICE_REQUIRED
  • ENQUEUE_FAILED
  • ENVIRONMENT_BIND_FAILED
  • ENVIRONMENT_NOT_FOUND
  • ENV_ACCESS_DENIED
  • ERR_AUTONUMBER_COLLISION
  • ERR_BULK_RESULT_MISMATCH
  • ERR_CROSS_DATASOURCE_TRANSACTION_WRITE
  • ERR_CURRENCY_CODE_REQUIRED
  • ERR_DATASOURCE_UNAVAILABLE
  • ERR_DRIVER_CONNECT
  • ERR_EXCHANGE_RATE_MISSING
  • ERR_FILE_CONSTRAINT
  • ERR_FILE_REFERENCE_COPY
  • ERR_HOME_CURRENCY_UNSET
  • ERR_HOOK_TARGET_REBIND
  • ERR_READONLY_FIELD_REJECTED
  • ERR_SUMMARY_RECOMPUTE
  • ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED
  • ERR_TRANSACTION_UNSUPPORTED
  • ERR_UNIT_CODE_REQUIRED
  • ERR_UNIT_CODE_RETIRED
  • ERR_UNIT_CODE_UNKNOWN
  • ERR_UNIT_DELETE_REFUSED
  • ERR_UNIT_DIMENSION_MISMATCH
  • ERR_WORK_CALENDAR_INVALID
  • ERR_WORK_CALENDAR_NOT_MAINTAINED
  • ERR_WORK_CALENDAR_UNRESOLVED
  • EXECUTION_ERROR
  • EXPIRED_OR_REVOKED
  • EXPIRY_IN_PAST
  • EXPIRY_TOO_LONG
  • EXPLAIN_FAILED
  • EXPORT_NOT_PERMITTED
  • EXTERNAL_DATASOURCE_ERROR
  • EXTERNAL_IMPORT_ERROR
  • EXTERNAL_ROW_CAP_EXCEEDED
  • EXTERNAL_SCHEMA_MISMATCH
  • EXTERNAL_SCHEMA_MODE_VIOLATION
  • EXTERNAL_WRITE_FORBIDDEN
  • EXTERNAL_WRITE_REFUSED
  • FEEDS_DISABLED
  • FIELD_VISIBILITY_UNRESOLVED
  • FILES_DISABLED
  • FILE_DOWNLOAD_DENIED
  • FILE_FIELD_BULK_WRITE_REFUSED
  • FILE_NOT_FOUND
  • FILTER_TOKEN_UNKNOWN
  • FILTER_TOKEN_UNRESOLVED
  • FIND_HOOK_RESULT_NOT_ARRAY
  • FIND_ONE_HOOK_RESULT_NOT_RECORD
  • FLOW_DISABLED
  • FLOW_FAILED
  • FLOW_INPUT_SCHEMA_INVALID
  • FLOW_NO_START_NODE
  • FORBIDDEN
  • FORM_NOT_FOUND
  • FORM_RESOLVE_FAILED
  • HOOK_ABORTED
  • HOOK_UNSCOPED_DATA_ACCESS
  • IMPORT_JOB_CREATE_FAILED
  • IMPORT_ROW_FAILED
  • INSTALL_MODE_NOT_PERMITTED
  • INTERNAL
  • INVALID_ARTIFACT_PACKAGES
  • INVALID_ARTIFACT_PACKAGE_ENTRY
  • INVALID_EMAIL
  • INVALID_EXPIRY
  • INVALID_METADATA
  • INVALID_OR_EXPIRED
  • INVALID_PHONE
  • INVALID_REQUEST
  • INVALID_RESUME_TOKEN
  • INVALID_SCREEN_INPUT
  • INVALID_SIGNAL
  • INVALID_SIGNATURE
  • INVALID_STATE
  • INVITE_EMAIL_FAILED
  • INVITE_ISSUER_MEMBER_ONLY
  • INVITE_ISSUER_UNVERIFIED
  • INVITE_PLACEMENT_OUTSIDE_ISSUER_SCOPE
  • INVITE_PLACEMENT_UNSUPPORTED
  • INVITE_REQUIRES_EMAIL
  • INVITE_ROLE_ABOVE_ISSUER
  • INVITE_SMS_FAILED
  • IP_NOT_ALLOWED
  • ITEM_LOCKED
  • LAST_LOCAL_CREDENTIAL
  • LEGACY_ORGANIZATION_ROWS_UNREADABLE
  • MANIFEST_CONFLICT
  • MAPPING_FORMAT_MISMATCH
  • MAPPING_FORMAT_UNSUPPORTED
  • MAPPING_NOT_FOUND
  • MAPPING_TARGET_MISMATCH
  • MARKETPLACE_PROXY_FAILED
  • MARKETPLACE_STORAGE_FAILED
  • MARKETPLACE_UNAVAILABLE
  • MEMORY_MULTI_TENANT_UNSUPPORTED
  • METADATA_BRANCH
  • METADATA_CONFLICT
  • METADATA_NOT_FOUND
  • METADATA_SCHEMA_INVALID
  • MIXED_ARTIFACT_COLLECTION_SHAPE
  • MONGODB_MULTI_TENANT_UNSUPPORTED
  • MULTI_REPLICA_PACKAGE_CHANGE_REFUSED
  • MULTI_UPDATE_HOOK_KEY_DIVERGENCE
  • NAMESPACE_CONFLICT
  • NAMESPACE_PREFIX
  • NEEDS_PASSWORD
  • NODE_FAILURE
  • NOTHING_TO_PURGE
  • NOT_ATTEMPTED
  • NOT_COMPENSABLE
  • NOT_CREATABLE
  • NOT_FOUND
  • NOT_OVERRIDABLE
  • NOT_UNDOABLE
  • NO_ACTIVE_ORGANIZATION
  • NO_DRAFT
  • NO_EXECUTOR
  • NO_IDENTITY
  • NO_MATCH
  • NO_PENDING_VERIFICATION
  • NO_SUCH_RUN
  • OAUTH_REGISTER_FAILED
  • OBJECT_API_DISABLED
  • OBJECT_API_METHOD_NOT_ALLOWED
  • OBJECT_OVERLAY_PACKAGE_MISMATCH
  • OBJECT_OWNERSHIP_CONFLICT
  • OBJECT_PACKAGE_DISABLED
  • OPENAPI_UNAVAILABLE
  • ORGANIZATION_CREATION_DISABLED
  • ORGANIZATION_OWNERSHIP_MIGRATION_REQUIRED
  • ORGANIZATION_SLUG_LOCKED_BY_ACTIVE_ENVIRONMENTS
  • OS_PROTOCOL_INCOMPATIBLE
  • PACKAGE_DELETE_FAILED
  • PACKAGE_DELETE_PARTIAL
  • PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE
  • PACKAGE_MANIFEST_INVALID
  • PACKAGE_PUBLISH_FAILED
  • PASSWORD_ALREADY_SET
  • PASSWORD_EXPIRED
  • PASSWORD_POLICY_VIOLATION
  • PASSWORD_RESET_REQUIRED
  • PASSWORD_REUSE
  • PAYLOAD_TOO_LARGE
  • PERMISSION_NOT_ALLOWED
  • PHONE_NOT_ENABLED
  • PLAN_CHANGED
  • PLUGIN_CONTRACT_VIOLATION
  • PLUGIN_INSTALL_FAILED
  • PLUGIN_MANIFEST_INVALID
  • PLUGIN_REGISTER_FAILED
  • PLUGIN_UI_REQUIRED_KEY_MISSING
  • PREFLIGHT_FAILED
  • PROJECT_MEMBERSHIP_REQUIRED
  • PROJECT_NOT_FOUND
  • PROJECT_PROVISIONING
  • PROJECT_PROVISIONING_FAILED
  • QUERY_OBJECT_MISMATCH
  • QUERY_ROW_BUDGET_EXCEEDED
  • QUEUE_NOT_FOUND
  • RAW_SQL_UNSUPPORTED
  • READ_BACK_FAILED
  • READ_SCOPE_COMPILE_FAILED
  • RECORD_GONE
  • RECORD_LOCKED
  • RECORD_NOT_ELIGIBLE
  • REGISTRY_TYPE_NOT_CANONICAL
  • REQUEST_NOT_FOUND
  • RESEED_NO_ROWS
  • RESEED_SKIPPED
  • RESTORE_PACKAGE_UNINSTALLED
  • RESTORE_PARENT_IN_RECYCLE_BIN
  • RESTORE_PARENT_PURGED
  • RESTORE_UNIQUE_VALUE_TAKEN
  • RESUME_CHILD_PENDING
  • RESUME_FAILED
  • RESUME_IN_PROGRESS
  • RESUME_TARGET_LOST
  • ROLE_NOT_FOUND
  • ROLLED_BACK
  • ROUTE_NOT_FOUND
  • RULE_DEFINE_FAILED
  • RULE_DELETE_FAILED
  • RULE_EVALUATE_FAILED
  • RULE_GET_FAILED
  • RULE_LIST_FAILED
  • RULE_NOT_FOUND
  • RUN_NOT_FOUND
  • SAML_REGISTER_FAILED
  • SCHEMA_UPGRADE_CONFIRMATION_REQUIRED
  • SELF_REGISTRATION_CLOSED
  • SERVICE_NOT_REGISTERED
  • SETTINGS_ACTION_FAILED
  • SETTINGS_CRYPTO_UNAVAILABLE
  • SETTINGS_ENGINE_NOT_BOUND
  • SETTINGS_FORBIDDEN
  • SETTINGS_LOCKED
  • SETTINGS_UNKNOWN_KEY
  • SETTINGS_UNKNOWN_NAMESPACE
  • SETTINGS_VALIDATION
  • SHARES_LIST_FAILED
  • SHARE_GRANT_FAILED
  • SHARE_REVOKE_FAILED
  • SHARING_NOT_ENABLED
  • SIGN_IN_REQUIRED
  • SMS_SERVICE_REQUIRED
  • SQL_DIALECT_EMISSION_UNSUPPORTED
  • SSO_REGISTER_FAILED
  • SSO_REGISTER_FORBIDDEN
  • STACK_CAPABILITY_UNKNOWN
  • STACK_COMPOSE_ACTION_KEY_COLLISION
  • STACK_COMPOSE_COLLECTION_CONFLICT
  • STACK_COMPOSE_FUNCTIONS_SHAPE_CONFLICT
  • STACK_COMPOSE_FUNCTION_CONFLICT
  • STACK_COMPOSE_KEY_CONFLICT
  • STACK_COMPOSE_OBJECT_CONFLICT
  • STACK_CROSS_REFERENCE_INVALID
  • STACK_HIERARCHY_SCOPE_CAPABILITY_REQUIRED
  • STACK_NAMESPACE_PREFIX_INVALID
  • STACK_PROVENANCE_MISSING
  • STACK_SCHEMA_INVALID
  • STACK_SINGLE_APP_VIOLATION
  • STACK_TRIGGER_CAPABILITY_REQUIRED
  • STACK_UNMANAGED_INSTALL_UNCOPYABLE
  • STACK_WEBHOOK_CAPABILITY_REQUIRED
  • STORED_TYPE_NOT_CANONICAL
  • STORE_UNAVAILABLE
  • SUGGESTION_CONFIRM_FAILED
  • SUGGESTION_DISMISS_FAILED
  • SUGGESTION_LIST_FAILED
  • SUGGESTION_NOT_FOUND
  • SUGGESTION_STATE
  • SUMMARY_RECOMPUTE_FAILED
  • THROTTLED
  • UNAUTHORIZED
  • UNIQUE_SCOPE_CONFIRMATION_REQUIRED
  • UNIQUE_VIOLATION
  • UNKNOWN_KEY
  • UNKNOWN_NAMESPACE
  • UNMANAGED_INSTALL_UNCOPYABLE
  • UNMANAGED_INSTALL_WALLED_POSTURE
  • UNSUPPORTED
  • UNSUPPORTED_QUERY_PARAM
  • UNSUPPORTED_TRANSFORM
  • UPDATE_HOOK_RESULT_NOT_WRITE_SHAPE
  • UPDATE_ID_MISMATCH
  • UPLOAD_SESSION_EXPIRED
  • UPLOAD_SESSION_NOT_FOUND
  • USER_ALREADY_EXISTS
  • USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL
  • VALIDATION_FAILED
  • VERSION_NOT_FOUND
  • VERSION_NOT_RESTORABLE
  • WALLED_MEMBERSHIP_POLICY_UNDECLARED
  • WRITABLE_PACKAGE_REQUIRED
  • WRONG_PASSWORD

GetFlowRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)

GetFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { name: string; label: string; description?: string; successMessage?: string; … } ✅ Full flow definition

Nested Shape: GetFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: GetFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: GetFlowResponse.data

Property Type Required Description
name string ✅ Machine name
label string ✅ Flow label
description string optional
successMessage string optional 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.
type Enum<'autolaunched' | 'record_change' | 'schedule' | 'screen' | 'api'> ✅ Flow type
variables { name: string; type: string; isInput?: boolean; isOutput?: boolean; … }[] optional Flow variables
nodes { id: string; type: string; label: string; config?: Record<string, any>; … }[] ✅ Flow nodes
edges { id: string; source: string; target: string; condition?: string | object; … }[] ✅ Flow connections
runAs Enum<'system' | 'user'> optional (default: "user") 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. 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.
errorHandling { strategy?: Enum<'fail' | 'retry' | 'continue'>; maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number; … } optional 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.
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this flow.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional 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.

GetRunRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
runId string ✅ Execution run ID

GetRunResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { id: string; flowName: string; flowVersion?: integer; status: Enum<'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | …>; … } ✅ Full execution log with step details

Nested Shape: GetRunResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: GetRunResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: GetRunResponse.data

Property Type Required Description
id string ✅ Execution instance ID
flowName string ✅ Machine name of the executed flow
flowVersion integer optional Version of the flow that was executed
status Enum<'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | …> ✅ Current execution status
refusalMessage string optional Rendered end node message when status is refused — the per-record text the flow refused with. Absent on every other status.
trigger { type: string; recordId?: string; object?: string; userId?: string; … } ✅ What triggered this execution
steps { nodeId: string; nodeType: string; nodeLabel?: string; status: Enum<'success' | 'failure' | 'skipped'>; … }[] ✅ Ordered list of executed steps
summary { selected: integer; acted: integer; skipped: integer; unmeasured?: integer; … } optional 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.
runAs Enum<'system' | 'user'> optional Execution context identity
tenantId string optional Tenant ID for multi-tenant isolation

ListRunsRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
status Enum<'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | 'timed_out' | 'retrying' | 'refused' | 'missed'> optional Filter by execution status
limit integer optional (default: 20) Maximum number of runs to return
cursor never optional [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.

ListRunsResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { runs: object[]; total?: integer; nextCursor?: string; hasMore: boolean } ✅

Nested Shape: ListRunsResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: ListRunsResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: ListRunsResponse.data

Property Type Required Description
runs { id: string; flowName: string; flowVersion?: integer; status: Enum<'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | …>; … }[] ✅ Execution run logs
total integer optional Total matching runs
nextCursor string optional Cursor for the next page
hasMore boolean ✅ 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.

RecordUpdateStart

Properties

Property Type Required Description
name string ✅ The flow's machine name — the key a client translates its label by (flows.<name>.label).
label string ✅ The flow's display label as authored (a client translates it by name).
startsApproval boolean ✅ Whether the flow contains an approval node, so the update starts an approval.

RecordUpdateStartsRequest

Properties

Property Type Required Description
object string ✅ Machine name of the record's object.
recordId string ✅ Id of the record the update would write.
changes Record<string, any> ✅ 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.

RecordUpdateStartsResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { flows: object[] } ✅

Nested Shape: RecordUpdateStartsResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: RecordUpdateStartsResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: RecordUpdateStartsResponse.data

Property Type Required Description
flows { name: string; label: string; startsApproval: boolean }[] ✅ The flows the update would start, in no promised order.

ResumeFailureDetails

Properties

Property Type Required Description
runId string ✅ 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

ToggleFlowRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
enabled boolean ✅ Whether to enable (true) or disable (false) the flow

ToggleFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { name: string; enabled: boolean } ✅

Nested Shape: ToggleFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: ToggleFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: ToggleFlowResponse.data

Property Type Required Description
name string ✅ Flow name
enabled boolean ✅ New enabled state

TriggerFlowRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
record Record<string, any> optional Record that triggered the automation
object string optional Object name the record belongs to
event string optional Trigger event type
userId string optional User who triggered the automation
params Record<string, any> optional Additional contextual data

TriggerFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { success: boolean; output?: any; error?: string; durationMs?: number; … } ✅

Nested Shape: TriggerFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: TriggerFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: TriggerFlowResponse.data

Property Type Required Description
success boolean ✅ Whether the automation completed successfully
output any optional Output data from the automation
error string optional Error message if execution failed
durationMs number optional Execution duration in milliseconds
code Enum<'PERMISSION_DENIED' | 'INVALID_SIGNAL' | 'RUN_NOT_FOUND' | 'STORE_UNAVAILABLE' | …> optional 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).
status Enum<'completed' | 'paused' | 'failed' | 'stranded' | 'refused'> optional 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
screen { nodeId: string; title?: string; description?: string; fields: object[]; … } optional 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
innerRefusal { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; message: string } optional 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
summary { selected: integer; acted: integer; skipped: integer; unmeasured?: integer; … } optional What the run did - records selected / acted on, gate skips, per-node status. Set on a TERMINAL result (a paused run has not finished doing it yet).
droppedFields { object: string; fields: string[]; reason: Enum<'readonly' | 'readonly_when' | 'primary_key' | 'computed' | 'stored_expression'> }[] optional 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).

UpdateFlowRequest

Properties

Property Type Required Description
name string ✅ Flow machine name (snake_case)
definition { name: string; label: string; description?: string; successMessage?: string; … } ✅ Complete flow definition to store — the engine requires a full flow; partial update is not implemented

Nested Shape: UpdateFlowRequest.definition

Property Type Required Description
name string ✅ Machine name
label string ✅ Flow label
description string optional
successMessage string optional 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.
type Enum<'autolaunched' | 'record_change' | 'schedule' | 'screen' | 'api'> ✅ Flow type
variables { name: string; type: string; isInput?: boolean; isOutput?: boolean; … }[] optional Flow variables
nodes { id: string; type: string; label: string; config?: Record<string, any>; … }[] ✅ Flow nodes
edges { id: string; source: string; target: string; condition?: string | object; … }[] ✅ Flow connections
runAs Enum<'system' | 'user'> optional (default: "user") 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. 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.
errorHandling { strategy?: Enum<'fail' | 'retry' | 'continue'>; maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number; … } optional 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.
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this flow.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional 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.

UpdateFlowResponse

Properties

Property Type Required Description
success boolean ✅ Operation success status
error { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …>; declaredCode?: string; message: string; userMessage?: string; … } optional Error details if success is false
meta { timestamp: string; duration?: integer; requestId?: string; traceId?: string } optional Response metadata
data { name: string; label: string; description?: string; successMessage?: string; … } ✅ The updated flow, canonicalized — the parsed shape the engine stored, identical to what a subsequent GET answers

Nested Shape: UpdateFlowResponse.error

Property Type Required Description
code Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | …> ✅ 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)
requestId string optional Request ID for tracking

Nested Shape: UpdateFlowResponse.meta

Property Type Required Description
timestamp string ✅
duration integer optional Server-side processing duration in milliseconds
requestId string optional
traceId string optional

Nested Shape: UpdateFlowResponse.data

Property Type Required Description
name string ✅ Machine name
label string ✅ Flow label
description string optional
successMessage string optional 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.
type Enum<'autolaunched' | 'record_change' | 'schedule' | 'screen' | 'api'> ✅ Flow type
variables { name: string; type: string; isInput?: boolean; isOutput?: boolean; … }[] optional Flow variables
nodes { id: string; type: string; label: string; config?: Record<string, any>; … }[] ✅ Flow nodes
edges { id: string; source: string; target: string; condition?: string | object; … }[] ✅ Flow connections
runAs Enum<'system' | 'user'> optional (default: "user") 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. 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.
errorHandling { strategy?: Enum<'fail' | 'retry' | 'continue'>; maxRetries?: integer; backoffMs?: integer; backoffMultiplier?: number; … } optional 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.
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this flow.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional 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.