Workflows API
Create automated document processing workflows with triggers, steps, and integrations. See Workflows and Workflow Automation for concepts. For event callbacks, see Webhooks.
List Workflows
GET /api/workflowsGet all workflows.
Response
{
"workflows": [
{
"id": "workflow-uuid",
"name": "Invoice Processing",
"description": "Automatically extract data from invoices",
"trigger_type": "event",
"trigger_config": {
"event": "document.uploaded",
"filters": {
"file_type": "pdf"
}
},
"enabled": true,
"created_at": "2024-01-01T00:00:00Z"
}
]
}Create Workflow
POST /api/workflowsCreate a new workflow.
Request
{
"name": "Invoice Processing",
"description": "Automatically extract data from invoices",
"definition": {
"steps": [
{
"id": "parse",
"type": "parse",
"config": {}
},
{
"id": "extract",
"type": "extract",
"config": {
"schema_id": "invoice-schema"
}
},
{
"id": "notify",
"type": "integration",
"config": {
"integration_id": "slack-uuid",
"template": "Invoice processed: {{invoice_number}}"
}
}
]
},
"trigger_type": "event",
"trigger_config": {
"event": "document.uploaded",
"filters": {
"file_type": "pdf",
"knowledge_base_id": "kb-uuid"
}
},
"enabled": true
}Trigger Types
| Type | Description |
|---|---|
manual | Triggered manually via API or dashboard |
scheduled | Runs on a cron schedule |
webhook | Triggered by external webhook |
event | Triggered by platform events |
Platform Events
| Event | Description |
|---|---|
document.uploaded | New document uploaded |
document.processed | Document finished processing |
extraction.completed | Extraction finished |
chat.message | New chat message received |
Step Types
| Type | Description |
|---|---|
parse | Parse a document |
extract | Extract data using schema |
transform | Transform data |
condition | Conditional branching |
integration | Send to external service |
Get Workflow
GET /api/workflows/{id}Update Workflow
PUT /api/workflows/{id}Delete Workflow
DELETE /api/workflows/{id}Execute Workflow
POST /api/workflows/{id}/executeManually trigger a workflow.
Request
{
"trigger_data": {
"document_id": "doc-uuid"
}
}Response
{
"execution_id": "execution-uuid",
"status": "running",
"started_at": "2024-01-15T10:00:00Z"
}Executions
List Executions
GET /api/workflows/{id}/executionsGet execution history for a workflow.
Query Parameters:
| Parameter | Description |
|---|---|
limit | Results per page |
execution_id | Filter by specific execution |
Response:
{
"executions": [
{
"id": "execution-uuid",
"status": "completed",
"triggered_by": "event",
"started_at": "2024-01-15T10:00:00Z",
"completed_at": "2024-01-15T10:00:30Z",
"execution_log": [
{
"step_id": "parse",
"status": "completed",
"duration_ms": 5000
},
{
"step_id": "extract",
"status": "completed",
"duration_ms": 3000
}
]
}
]
}Schedules
Get Schedule
GET /api/workflows/{id}/scheduleCreate Schedule
POST /api/workflows/{id}/scheduleCreate a cron schedule for the workflow.
{
"cron_expression": "0 9 * * 1-5",
"timezone": "America/New_York"
}Common cron patterns:
| Pattern | Description |
|---|---|
0 9 * * * | Daily at 9 AM |
0 9 * * 1-5 | Weekdays at 9 AM |
0 0 * * 0 | Weekly on Sunday |
0 0 1 * * | Monthly on the 1st |
Update Schedule
PUT /api/workflows/{id}/schedule{
"cron_expression": "0 10 * * 1-5",
"enabled": true
}Delete Schedule
DELETE /api/workflows/{id}/scheduleIntegrations
List Integrations
GET /api/workflows/integrationsGet all workflow integrations.
Query Parameters:
| Parameter | Description |
|---|---|
workflow_id | Filter by workflow |
Create Integration
POST /api/workflows/integrationsCreate a new integration.
{
"workflow_id": "workflow-uuid",
"name": "Slack Notifications",
"integration_type": "slack",
"config": {
"webhook_url": "https://hooks.slack.com/...",
"channel": "#invoices"
}
}Integration Types
| Type | Config Fields |
|---|---|
slack | webhook_url, channel |
email | to, subject, template |
webhook | url, method, headers |
Update Integration
PUT /api/workflows/integrations?id={id}Delete Integration
DELETE /api/workflows/integrations?id={id}Templates
List Templates
GET /api/workflows/templatesGet available workflow templates.
Query Parameters:
| Parameter | Description |
|---|---|
category | Filter by category |
Categories:
invoice- Invoice processingcontract- Contract workflowsresume- Resume processinggeneral- General purpose
Create from Template
POST /api/workflows/templatesCreate a workflow from a template.
{
"template_id": "template-uuid",
"name": "My Invoice Workflow",
"description": "Custom invoice processing"
}See also: Workflows, Workflow Automation, Webhooks.
Last updated on