Workflows
SDK reference for workflows — Create, update, execute, and manage workflows, nodes, and edges.
Create, update, execute, and manage workflows, nodes, and edges.
getWorkflowSnapshot
Get a workflow snapshot with all its nodes and edges. Each node has position: { x, y } (canvas coordinates). Use before executeWorkflow.
GET
Usage:
const result = await swirls.client.workflows.getWorkflowSnapshot({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
deploymentId | string | null | |
workflowId | string | |
name | string | |
label | string | |
description | string | null | |
createdAt | unknown | |
orgId | string | |
userId | string | |
nodes | object[] | |
edges | object[] |
listWorkflows
List one row per stable workflow with preferred snapshot, version count, and active-deployment flag.
GET
Usage:
const result = await swirls.client.workflows.listWorkflows({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
executeWorkflow
Execute a workflow with input data. Returns an execution ID that can be used to track progress via get_execution.
POST
Usage:
const result = await swirls.client.workflows.executeWorkflow({
workflowId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
workflowId | string | Yes | |
input | object | No |
Output:
| Field | Type | Description |
|---|---|---|
executionId | string |
getExecution
Get the status and results of a workflow execution, including all node executions. Use the executionId returned by execute_workflow. The response includes the overall status and each node's individual execution status and output.
GET
Usage:
const result = await swirls.client.workflows.getExecution({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
parentWorkflowExecutionId | string | null | |
workflowSnapshotId | string | null | |
workflowId | string | null | |
deploymentId | string | null | |
executorType | string | |
executorId | string | |
triggerId | string | null | |
triggerType | string | null | |
status | string | |
input | unknown | |
output | unknown | |
outputFormatHints | object | null | |
formattedOutput | unknown | null | |
error | string | null | |
startedAt | unknown | |
completedAt | unknown | null | |
createdAt | unknown | |
orgId | string | |
userId | string | |
nodeExecutions | object[] |
listRunnableWorkflows
List workflows in a deployment with each workflow's entry node input schema and last execution. id in each row is the workflow snapshot id. Last execution aggregates by stable workflow when possible.
GET
Usage:
const result = await swirls.client.workflows.listRunnableWorkflows({
projectId: '...',
deploymentId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
deploymentId | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
results | object[] |