Stacklink
Workflows

Workflow reference

Operations, permissions, limits and errors. Keep this beside your code.

Start with the complete SDK example. All paths below are relative to /v1/workflows; use your project key on the backend. MCP clients should load STACKLINK_WORKFLOWS → contract for exact schemas.

Definitions and publication

TypeScript / PythonRESTPurpose
listGET /Page through definitions (limit, cursor, search)
createPOST /Create a draft
get / updateGET / PATCH /:idRead/edit with the current revision
validatePOST /validateCheck a typed definition
publishPOST /:id/publishPublish graph and draft triggers together
versionsGET /:id/versionsInspect published setups
setState / set_statePOST /:id/stateSet { paused }

source: "visual" permits canvas editing. "code" makes the canvas read-only. Set it explicitly: Python defaults to code; the backend defaults to visual. Optional deployment records repositoryUrl (HTTPS), commit and definitionKey.

A duplicate name receives (1), (2), etc. Keep the returned ID and saved name. Creating again is not updating.

Runs and recovery

TypeScript / PythonREST
runPOST /:id/runs
runsGET /:id/runs
getRun / get_runGET /:id/runs/:runId
eventsGET /:id/runs/:runId/events
actionPOST /:id/runs/:runId/actions

Public starts require sessionId and jobKey. mode is simulation or live; purpose is test or operational. A draft test also supplies revision. Samples are keyed by node ID. If supplied, Idempotency-Key must match jobKey.

Lists return runs and nextCursor. Events use before for the next page. Save workflow/run IDs; one getRun() does not wait for completion.

// IDs come from the saved run and selected step, never their display names.
const current = await stacklink.workflows.getRun(workflowId, runId);
await stacklink.workflows.action(workflowId, current.id, {
  action: 'reconcile', nodeId,
});

Actions: retry, reconcile, confirm, repeat, signal, cancel. Confirm/repeat need a reason; signals supply event and value. Read the recovery rules before choosing one. A fresh run uses run() with a new key.

Run status values

queued, running, waiting, waiting_for_approval, retrying, needs_attention, failed, completed, cancel_requested, cancelled.

Waiting and needs-attention are not completion. A recovered failed run remains the same run. Historical run definitions are immutable even while the current draft changes.

Triggers

TypeScript / PythonREST
triggersGET /:id/triggers
saveTrigger / save_triggerPOST /:id/triggers
deleteTrigger / delete_triggerDELETE /:id/triggers/:triggerId
invokeTrigger / invoke_triggerPOST /:id/triggers/:triggerId/invoke
previewSchedule / preview_schedulePOST /schedule/preview

Read returns revision, draft triggers and liveTriggers. Save/delete require expectedRevision (Python: expected_revision); publish the returned revision to activate. Invocation uses requestId and input; its optional idempotency header must match requestId. Examples →

Drafting and mentions

searchMentions / search_mentions searches the permitted catalog before paging. Query: search, optional workflowId / kind, offset, limit. Each group returns total and nextOffset.

resolveMentions / resolve_mentions rechecks exact references. suggest(id, description, revision, sessionId, mentions?) returns a proposal, not an applied change. Use update() to accept a reviewed definition.

ReferenceShape
App, Bot or workflow{ kind, id } with kind app, bot or workflow
Saved API operation{ kind: "api", id, callId }
Mention in a description{ reference, start, end }

Offsets are UTF-16 positions; end is exclusive. Ranges must not overlap or split a surrogate pair. Server-side resolution rechecks identity and access; labels or pasted chips cannot grant authority. Mention APIs require server SDK 0.6.3 or later.

Permissions

ScopeUse
workflows:readInspect permitted definitions and runs
workflows:manageAuthor, publish and manage triggers/settings
workflows:runSubmit runs and request recovery; action-specific checks still apply
sessions:create, sessions:readCreate and inspect the execution identity
tools:execute, connection/Bot/Memory scopesRequired by the actual steps you choose
billing:readAuthorized financial reporting

Project membership, customer ownership and step-specific policy still apply. A scope does not create an app connection or grant somebody else’s account. Embedded roles and approvals →

Limits

SettingCurrent limit
Graph200 nodes; 500 edges; no cycles
Code step1 second–10 minutes; default 60 seconds
Automatic attempts1–10; default 3 including the first try
Timer / event / approval / form waitUp to one year
Workflow concurrency1–100 per customer; default 10
Record concurrencyDefault 1 when a record key is used
For eachUp to 1,000 items; concurrency up to 20
Nested executionsMaximum child depth 10; recursive calls blocked
Schedule intervalMinimum five minutes
Remove-duplicates retention1–365 days; default 30 (separate from run job keys)

Common errors

CodeNext step
api_key_scope_missingCheck the key’s required scope
workflow_not_publishedPublish, or explicitly select a draft revision for a test
workflow_revision_changedReload the current draft and review conflicting changes
workflow_job_key_conflictReuse the original request; use a new key only for new work
workflow_mention_unavailableChoose an accessible resource again
workflow_record_key_missingSupply the configured record field
workflow_api_revision_changedSelect the current saved API operation revision
workflow_not_found / workflow_run_not_foundCheck identity, ownership and ID
approval_not_assignedThe authenticated person is not assigned this task

The embedded browser maps missing/inaccessible workflows and runs to workflow_unavailable. Do not try another customer’s context as a fallback.

On this page