Donutwork Docs

Workflow

Execute workflow runs, automate multi-stage operational tasks, and monitor execution lifecycle.

Workflow API

The Workflow API provides an engine for orchestrating complex, multi-stage business processes. By defining structured workflows, organizations can automate repetitive operational tasks, ensuring deterministic execution and full auditability. The engine supports dynamic payload injection for contextualized automation across the platform.


Workflow Management

List Workflows

Retrieve a comprehensive directory of all registered business workflows for your organization. This inventory includes the operational status, task count, and administrative metadata for each automation.

GET
/2026-02-01/workflow.json
Required permissionworkflow:readApiAccessPermission::WORKFLOW_READ

Query Parameters

sizeinteger
Maximum records per page (max 100).
pageinteger
Target page index.

Responses

Workflow inventory successfully retrieved.

{
  "entities": "Workflow",
  "count": 12,
  "per_page": 100,
  "pages": {
    "current": 1,
    "max": 1
  },
  "elements": [
    {
      "id": "6724bffd...",
      "name": "Enterprise Onboarding Logic",
      "active": true,
      "tasks_count": 8,
      "description": "Orchestrates account provisioning and initial compliance checks."
    }
  ]
}

Technical Implementation

curl --location --request GET \
'https://api.hub.donutwork.com/2026-02-01/workflow.json' \
--header 'Authorization: Bearer YOUR_API_TOKEN'
try {
  const inventory = await sdk.workflow.list();
  console.log(`Active Automations: ${inventory.count}`);
} catch (error) {
  console.error(`Workflow Audit Failed: ${error.message}`);
}

Workflow Execution

Dispatch Workflow Execution

Trigger the execution of a specific business workflow. This endpoint accepts a dynamic data payload that is injected into the execution context, allowing tasks to operate on real-time request data.

POST
/2026-02-01/workflow/{workflowId}.json
Required permissionworkflow:writeApiAccessPermission::WORKFLOW_WRITE

Query Parameters

workflowIdstringRequired
The unique identifier of the workflow to execute.

Request Body

JSON
{
  "data": {
    "customer_id": "cust_9921",
    "priority": "high",
    "metadata": {
      "source": "api_v2"
    }
  }
}
dataobjectRequired
Dynamic context data injected into the workflow execution.

Responses

Workflow execution completed. Detailed stage results returned.

{
  "success": true,
  "execution_id": "exe_8821abd033",
  "stages": [
    {
      "node": "validate_identity",
      "status": "completed",
      "output": {
        "valid": true
      }
    }
  ]
}

The specified workflow identifier does not exist.

{
  "error": "This workflow does not exists"
}

Technical Implementation (Execution Flow)

const context = {
  data: {
    userId: "USR-001",
    action: "PROVISION_RESOURCE",
    quota: 100
  }
};

try {
  const result = await sdk.workflow.execute("ONBOARD_WF_01", context);
  if (result.success) {
    console.log(`Automation Finished: ${result.execution_id}`);
  }
} catch (error) {
  console.error(`Execution Halted: ${error.message}`);
}

Auditability: Every workflow execution generates a unique execution_id and provides detailed telemetry for each stage (node) within the sequence, including input/output data and operational latency.


Workflow Tracing

List Workflow Traces

Retrieve paginated execution traces for a workflow.

GET
/2026-02-01/workflow/{workflowId}/traces.json
Required permissionworkflow_traces:readApiAccessPermission::WORKFLOW_TRACES_READ

Query Parameters

workflowIdstringRequired
Workflow identifier.
sizeinteger
Records per page (default 50, max 100).
pageinteger
Page number starting from 1.

Responses

Trace list retrieved.

{
  "entities": "WorkflowTrace",
  "count": 2,
  "per_page": 50,
  "pages": {
    "current": 1,
    "max": 1
  },
  "elements": [
    {
      "id": "6803f0f1...",
      "workflow_id": "67ffac1f...",
      "uuid": "d76d716e-0f91-4f7f-b37f-4475e573f807",
      "run_date": "2026-04-20T08:41:12+00:00",
      "status": "executed"
    }
  ]
}

Workflow not found.

{
  "error": "This workflow does not exists"
}

Get Workflow Trace

Load full trace payload for one workflow run.

GET
/2026-02-01/workflow/{workflowId}/traces/{traceId}.json
Required permissionworkflow_traces:readApiAccessPermission::WORKFLOW_TRACES_READ

Query Parameters

workflowIdstringRequired
Workflow identifier.
traceIdstringRequired
Trace identifier.

Responses

Trace retrieved.

{
  "id": "6803f0f1...",
  "workflow_id": "67ffac1f...",
  "uuid": "d76d716e-0f91-4f7f-b37f-4475e573f807",
  "run_date": "2026-04-20T08:41:12+00:00",
  "status": "executed",
  "response": {
    "input": {
      "customer_id": "cust_9921"
    },
    "result": {
      "workflow_status": "executed"
    },
    "stages": [
      {
        "node_name": "validate_identity",
        "status": "SUCCESS",
        "duration": 0.1281
      }
    ]
  }
}

Trace not found for workflow.

{
  "error": "Trace not found for this workflow."
}

On this page