Skip to main content

Workflows API

Create, manage, and execute multi-step agent workflows.
All workflow endpoints require session authentication. Workflows are scoped to the authenticated user — you can only access workflows that belong to your account.

List workflows

GET /api/workflows
Returns all workflows owned by the authenticated user, ordered by most recently updated. Each workflow includes its associated nodes.

Response

{
  "workflows": [
    {
      "id": "wf_abc123",
      "name": "Email Automation",
      "description": null,
      "enabled": true,
      "createdAt": "2026-03-29T10:00:00Z",
      "updatedAt": "2026-03-29T11:00:00Z",
      "nodes": [
        {
          "id": "node_1",
          "type": "trigger",
          "config": "{\"label\":\"Trigger 1\"}",
          "position": "{\"x\":40,\"y\":40}"
        }
      ]
    }
  ]
}
FieldTypeDescription
workflowsarrayList of workflow objects owned by the authenticated user
workflows[].idstringWorkflow identifier
workflows[].namestringWorkflow name
workflows[].descriptionstring | nullOptional workflow description
workflows[].enabledbooleanWhether the workflow is active
workflows[].createdAtstringISO 8601 creation timestamp
workflows[].updatedAtstringISO 8601 last update timestamp
workflows[].nodesarrayList of workflow nodes
workflows[].nodes[].idstringNode identifier
workflows[].nodes[].typestringNode type (trigger, action, condition, or output)
workflows[].nodes[].configstringJSON-encoded node configuration including the node label
workflows[].nodes[].positionstringJSON-encoded {x, y} coordinates for the node in the visual builder

Errors

CodeDescription
401Unauthorized — returns { "workflows": [] } instead of an error object
500Failed to load workflows
When the session is missing or invalid, this endpoint returns an empty workflows array with a 401 status instead of a standard error object.

Create workflow

POST /api/workflows
Creates a new workflow with optional initial nodes. The workflow is enabled by default.

Request body

FieldTypeRequiredDescription
namestringYesWorkflow name
descriptionstringNoWorkflow description
nodesarrayNoInitial nodes to create with the workflow
nodes[].typestringYesNode type. One of: trigger, action, condition, output
nodes[].configobjectNoNode configuration (for example, { "label": "My Node" }). Stored as a JSON string. Defaults to {}.
nodes[].positionobjectNoNode position (for example, { "x": 40, "y": 40 }). Stored as a JSON string. Defaults to { "x": 0, "y": 0 }.

Response (201 Created)

{
  "workflow": {
    "id": "wf_abc123",
    "name": "Email Automation",
    "description": null,
    "enabled": true,
    "createdAt": "2026-03-29T10:00:00Z",
    "updatedAt": "2026-03-29T10:00:00Z",
    "nodes": []
  }
}

Errors

CodeDescription
400Name required
401Unauthorized
500Failed to create workflow

Get workflow

GET /api/workflows/:workflowId
Returns a single workflow with its nodes ordered by creation time. Requires ownership.

Path parameters

ParameterTypeDescription
workflowIdstringWorkflow identifier

Response

{
  "workflow": {
    "id": "wf_abc123",
    "name": "Email Automation",
    "description": "Processes inbound emails",
    "enabled": true,
    "createdAt": "2026-03-29T10:00:00Z",
    "updatedAt": "2026-03-29T11:00:00Z",
    "nodes": [
      {
        "id": "node_1",
        "type": "trigger",
        "config": "{\"label\":\"Email Received\"}",
        "position": "{\"x\":40,\"y\":40}",
        "createdAt": "2026-03-29T10:00:00Z"
      }
    ]
  }
}

Errors

CodeDescription
401Unauthorized
404Workflow not found or not owned by user
500Internal server error

Update workflow

PUT /api/workflows/:workflowId
Updates a workflow’s metadata and optionally replaces all nodes. Requires ownership. When nodes is provided, all existing nodes are deleted and replaced with the new set.

Path parameters

ParameterTypeDescription
workflowIdstringWorkflow identifier

Request body

FieldTypeRequiredDescription
namestringNoUpdated workflow name
descriptionstringNoUpdated workflow description
enabledbooleanNoEnable or disable the workflow
nodesarrayNoComplete replacement set of nodes. When provided, all existing nodes are deleted first.
nodes[].typestringYesNode type. One of: trigger, action, condition, output
nodes[].configobjectNoNode configuration. Stored as a JSON string. Defaults to {}.
nodes[].positionobjectNoNode position. Stored as a JSON string. Defaults to { "x": 0, "y": 0 }.
Providing the nodes field replaces all existing nodes. To update workflow metadata without affecting nodes, omit the nodes field entirely.

Response

{
  "workflow": {
    "id": "wf_abc123",
    "name": "Email Automation v2",
    "description": "Updated workflow",
    "enabled": true,
    "createdAt": "2026-03-29T10:00:00Z",
    "updatedAt": "2026-03-29T12:00:00Z",
    "nodes": [
      {
        "id": "node_new_1",
        "type": "trigger",
        "config": "{\"label\":\"Trigger 1\"}",
        "position": "{\"x\":40,\"y\":40}"
      },
      {
        "id": "node_new_2",
        "type": "action",
        "config": "{\"label\":\"Action 1\"}",
        "position": "{\"x\":240,\"y\":120}"
      }
    ]
  }
}

Errors

CodeDescription
401Unauthorized
404Workflow not found or not owned by user
500Internal server error

Delete workflow

DELETE /api/workflows/:workflowId
Permanently deletes a workflow and all its nodes. Requires ownership.

Path parameters

ParameterTypeDescription
workflowIdstringWorkflow identifier

Response

{
  "deleted": true
}

Errors

CodeDescription
401Unauthorized
404Workflow not found or not owned by user
500Internal server error

Node types

Workflows support four node types:
TypeDescription
triggerEntry point that starts the workflow
actionPerforms an operation such as an API call or message send
conditionEvaluates a condition and branches the flow
outputProduces a final result or side effect
Each node stores its configuration and visual position as JSON strings. The config object typically includes a label field used for display in the visual builder.