Skip to content

Workflows

Execute workflow

Run the active deployment, or set `run.source: "manual"` to run the saved draft. Deployed execution requires workspace read access and OAuth `api:write` scope or an API key; public deployments also allow anonymous synchronous or streamed runs. Manual runs require personal-key or OAuth write access and cannot be async. Use `async: true` for a queue receipt, or `stream: true` for SSE. For a synchronous run with both flags false, send `Accept: application/x-ndjson` for heartbeat frames and a final frame containing `data`. With `waitTimeoutSeconds`, a synchronous run still going when the wait elapses continues in the background and answers with its run receipt instead: `202` on a JSON response, or a closing `detached` frame on an NDJSON stream, which keeps its `200`. Timeouts return `200` with `status: "failed"` and `error.code: "TIMEOUT"`; inspect run status. See [Streaming](/workflows/deployment/api#streaming) for event formats. Input descriptions specify compatible modes; invalid combinations return `400`. Supply `X-Run-Id` to prevent duplicate execution. Reuse returns `409`, without replaying results. A `503` with `error.details.code: "ASYNC_ENQUEUE_AMBIGUOUS"` omits `Retry-After` because the run may already have started. Reconcile using the returned run ID; do not start another run with a new or omitted ID. OAuth scope: `api:write`.

POST/api/v2/workflows/{workflowId}/execute

Run the active deployment, or set run.source: "manual" to run the saved draft. Deployed execution requires workspace read access and OAuth api:write scope or an API key; public deployments also allow anonymous synchronous or streamed runs. Manual runs require personal-key or OAuth write access and cannot be async.

Use async: true for a queue receipt, or stream: true for SSE. For a synchronous run with both flags false, send Accept: application/x-ndjson for heartbeat frames and a final frame containing data. With waitTimeoutSeconds, a synchronous run still going when the wait elapses continues in the background and answers with its run receipt instead: 202 on a JSON response, or a closing detached frame on an NDJSON stream, which keeps its 200. Timeouts return 200 with status: "failed" and error.code: "TIMEOUT"; inspect run status. See Streaming for event formats. Input descriptions specify compatible modes; invalid combinations return 400.

Supply X-Run-Id to prevent duplicate execution. Reuse returns 409, without replaying results. A 503 with error.details.code: "ASYNC_ENQUEUE_AMBIGUOUS" omits Retry-After because the run may already have started. Reconcile using the returned run ID; do not start another run with a new or omitted ID.

OAuth scope: api:write.

Authentication

Send a personal or workspace API key in X-API-Key. See key types and access; operations that reject workspace keys say so in their description.

Send X-API-Key in the request header.

Alternatively

Send a Sim OAuth access token in Authorization: Bearer. See OAuth authentication and scopes.

Authorization: Bearer YOUR_ACCESS_TOKEN

Required scopes: api:write

OAuth flows
json
{
  "authorizationCode": {
    "authorizationUrl": "https://www.sim.ai/api/auth/oauth2/authorize",
    "tokenUrl": "https://www.sim.ai/api/auth/oauth2/token",
    "refreshUrl": "https://www.sim.ai/api/auth/oauth2/token",
    "scopes": {
      "api:read": "Read your workspaces, workflows, files, tables, and logs",
      "api:write": "Read, create, change, run, and delete resources in your workspaces",
      "offline_access": "Stay signed in without asking again"
    }
  }
}

Alternatively

Anonymous access is permitted.

OAuth scope: api:write.

Path parameters

workflowIdstringRequired

Unique workflow identifier.

minLength
1

Header parameters

x-run-idstring

Run ID for API-key or OAuth callers; ignored for anonymous requests. Reuse it after an uncertain response: a claimed ID returns 409 with RUN_ID_CONFLICT, without replaying results. Check Get workflow run, but 404 can persist while the ID remains claimed and does not establish whether execution started. Do not automatically restart with a fresh or omitted ID; either can start another run.

minLength
1
maxLength
128
pattern
^[A-Za-z0-9._:-]+$
x-sim-viastring

Comma-separated workflow identifiers naming the workflow-to-workflow call chain that led to this request. Each hop appends its own workflow id, and Sim sets it automatically; supply it yourself only when relaying an existing chain. A chain at the maximum depth is rejected with 409 and error.details.code: "CALL_CHAIN_DEPTH_EXCEEDED".

Request body

Required

Input, workflow-state selection, and execution-mode options. Input descriptions specify compatible modes; invalid combinations return 400.

object

Input, workflow-state selection, and execution-mode options. Input descriptions specify compatible modes; invalid combinations return 400.

11 fields
inputobject

Workflow input keyed by the selected trigger input-field name.

Schema details
Additional propertiesvalue

Value supplied for one workflow input field.

runvalue

Workflow state and entry point to execute. Omit for the active deployment. Manual execution requires OAuth or personal-key write access and supports synchronous or streamed runs only; waitTimeoutSeconds lets a synchronous one continue in the background.

Schema details

Exactly one of

Option 1object
1 field
sourcestringRequired

Execute the active deployed workflow state.

const
deployment

Additional properties are not allowed.

Option 2object
3 fields
sourcestringRequired

Execute the current saved workflow state manually.

const
manual
entryvalue

Manual entry mode. Omit to enter through the workflow trigger; a block entry requires an exact source run.

Schema details

Exactly one of

Option 1object
3 fields
typestringRequired

Enter the manual run through a runnable trigger.

const
trigger
blockIdstring

Runnable trigger block to enter through. Omit only when the saved workflow has exactly one runnable trigger.

minLength
1
useMockPayloadboolean

Use the selected trigger's server-derived mock payload. Cannot be combined with input.

Additional properties are not allowed.

Option 2object
3 fields
typestringRequired

Resume manual execution at a block using persisted upstream state.

const
block
blockIdstringRequired

Saved workflow block at which manual execution should resume.

minLength
1
sourceRunIdstringRequired

Run in this workflow whose persisted execution state supplies upstream block results. Missing or expired state returns 404.

minLength
1

Additional properties are not allowed.

stopAfterBlockIdstring

Saved workflow block after which the run stops; downstream blocks do not execute. Must not be inside a loop or parallel. If a router, condition, or untaken error path routes the run away from the block, the run fails as soon as that is decided; no further block starts, though blocks already running finish. With a block entry naming the same block, re-runs only that block against the source run.

minLength
1

Additional properties are not allowed.

asyncboolean

Queue the run and return a 202 receipt. Requires an API key or OAuth access token and a deployed run source. Cannot stream, select outputs, enable thinking/tool events, or include file-inlining options (includeFileBase64 or base64MaxBytes).

default
false
executionTimeoutSecondsinteger

Maximum duration of an asynchronous run, in seconds, capped by the plan's execution timeout. Requires async: true or waitTimeoutSeconds; otherwise returns 400.

minimum
1
maximum
604800
waitTimeoutSecondsinteger

Wait at most this many seconds for a synchronous run; 0 waits until it settles. A run still going then continues in the background and the response carries its run receipt instead of its result: 202 on a JSON response, or a closing detached frame on an application/x-ndjson result stream, which keeps its 200. The receipt is sent only once the run can be read on the runs resource, where it can also be cancelled. The run is admitted under asynchronous limits, and a dropped connection no longer cancels it. Requires an API key or OAuth access token. Cannot be combined with async or stream.

minimum
0
maximum
604800
streamboolean

Return Server-Sent Events instead of JSON when true. Cannot be combined with async.

default
false
selectedOutputsarray

Select <blockName>.<outputPath> or <childWorkflowId>.<blockName>.<outputPath> using normalized block reference names. Child selectors cover every invocation. Synchronous results use selector strings verbatim as blockOutputs keys; streaming selections shape the envelope. Unknown block names or IDs return 400 with available blocks before execution. Unexecuted blocks and absent paths are omitted. Incompatible with async; select outputs from the finished run resource instead.

maxItems
100
Schema details
Array itemstring
minLength
1
includeThinkingboolean

Include model reasoning events in an agent-event stream. Requires stream: true and the X-Sim-Stream-Protocol: agent-events-v1 request header, and is rejected when async is true.

default
false
includeToolCallsboolean

Include tool-call events in an agent-event stream. Requires stream: true and the X-Sim-Stream-Protocol: agent-events-v1 request header, and is rejected when async is true.

default
false
includeFileBase64boolean

Inline eligible output files as base64 content. Rejected when async is true.

base64MaxBytesinteger

Maximum total bytes of file content to inline as base64, lowering but never raising the server limit of 16 MiB. Rejected when async is true.

maximum
16777216
exclusiveMinimum
0

Additional properties are not allowed.

Request example 1

json
{
  "input": {
    "ticketId": "ticket_123"
  }
}

Request example 2

json
{
  "input": {
    "ticketId": "ticket_123"
  },
  "async": true
}

Request example 3

json
{
  "input": {
    "ticketId": "ticket_123"
  },
  "stream": true
}

Request example 4

json
{
  "run": {
    "source": "manual"
  }
}

Request example 5

json
{
  "run": {
    "source": "manual"
  },
  "waitTimeoutSeconds": 240
}

Request example 6

json
{
  "run": {
    "source": "manual",
    "entry": {
      "type": "block",
      "blockId": "block_123",
      "sourceRunId": "run_123"
    }
  }
}

Request example 7

json
{
  "run": {
    "source": "manual",
    "entry": {
      "type": "block",
      "blockId": "block_123",
      "sourceRunId": "run_123"
    },
    "stopAfterBlockId": "block_123"
  }
}

Responses

200

A synchronous run result, heartbeat-delimited NDJSON result stream, or Server-Sent Event stream.

object

Completed, failed, paused, or cancelled synchronous workflow run.

1 field
dataobjectRequired

Response data.

9 fields
runIdstringRequired

Unique workflow run identifier.

minLength
1
maxLength
128
pattern
^[A-Za-z0-9._:-]+$
workflowIdstringRequired

Workflow that produced the run.

statusstringRequired

Terminal or paused run status.

enum
["completed","failed","paused","cancelled"]
outputvalueRequired

Workflow output, including partial output on failure.

blockOutputsvalueRequired

Outputs of the blocks named by selectedOutputs, keyed by those selector strings exactly as sent, or null when none were requested. output stays the final workflow output regardless. Selectors whose block did not run or whose path is absent are omitted (an unknown block is a 400 instead); failed runs include the outputs of the blocks that did run.

Schema details

Any of

Option 1object
Schema details
Additional propertiesvalue

Output value produced by one workflow block.

Option 2null
errorvalueRequired

Structured execution failure, or null when none occurred.

Schema details

Any of

Option 1object

Structured in-band failure details for a workflow run.

5 fields
messagestringRequired

Human-readable workflow execution failure message.

codestringRequired

Stable machine-readable execution failure code. BLOCK_EXECUTION_FAILED and CHILD_WORKFLOW_FAILED are reported only where block attribution is available; elsewhere a block-level failure is reported as EXECUTION_FAILED.

enum
["TIMEOUT","CANCELLED","USAGE_LIMIT_EXCEEDED","INVALID_INPUT","BLOCK_EXECUTION_FAILED","CHILD_WORKFLOW_FAILED","EXECUTION_FAILED"]
blockIdstring

Identifier of the failing block. Present on the synchronous execute response only; the polled run resource and the resume response cannot attribute a block.

blockNamestring

Display name of the failing block. Present on the synchronous execute response only.

blockTypestring

Integration or block type that failed. Present on the synchronous execute response only.

Additional properties are not allowed.

Option 2null
startedAtstring

ISO 8601 timestamp when execution started.

format
date-time
endedAtstring

ISO 8601 timestamp when execution ended.

format
date-time
durationMsnumber

Execution duration in milliseconds.

minimum
0

Additional properties are not allowed.

Additional properties are not allowed.

Response example 1

json
{
  "data": {
    "runId": "run_8f14e45f-ceea-467f-a",
    "workflowId": "3b1f7c92-8d4e-4a6b-9c0d-5e2f8a714b36",
    "status": "completed",
    "output": {
      "result": "Ticket routed to Support"
    },
    "blockOutputs": null,
    "error": null,
    "startedAt": "2026-08-09T18:04:10.000Z",
    "endedAt": "2026-08-09T18:04:11.000Z",
    "durationMs": 1000
  }
}

Response headers

X-Run-Idstring

Identifier assigned to the workflow run.

minLength
1
X-RateLimit-Limitinteger

Maximum requests allowed in the current window.

minimum
0
maximum
9007199254740991
X-RateLimit-Remaininginteger

Requests remaining in the current window.

minimum
0
maximum
9007199254740991
X-RateLimit-Resetstring

ISO 8601 timestamp when the current rate-limit window resets.

format
date-time
pattern
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
Was this helpful?
Suggest an edit