Base URL
http://localhost:8009/api/v1
All endpoints are prefixed with /api/v1. Authentication is via Bearer token in the Authorization header.
Workflows
Create Workflow
POST
/api/v1/flows/createCreate a new workflow with steps and configuration.
Request Body:
{
"name": "Citizen Inquiry Router",
"description": "Classify and route citizen inquiries to departments",
"trigger": "api",
"steps": [
{
"id": "classify",
"name": "Classify Inquiry",
"type": "llm_call",
"config": {
"prompt": "Classify this citizen inquiry: {{input.message}}",
"model": "llama-3.3-70b-versatile"
},
"next_step": "route",
"timeout_seconds": 30
},
{
"id": "route",
"name": "Route to Department",
"type": "conditional",
"config": {
"branches": [
{"condition": "category == 'visa'", "next_step": "visa_handler"},
{"condition": "category == 'permit'", "next_step": "permit_handler"}
]
}
}
],
"variables": {"department": "general"},
"tags": ["citizen-services", "routing"]
}
Response:
{
"id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
"name": "Citizen Inquiry Router",
"description": "Classify and route citizen inquiries to departments",
"trigger": "api",
"status": "active",
"steps_count": 2,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"tags": ["citizen-services", "routing"],
"total_runs": 0,
"success_rate": 0.0
}
List Workflows
GET
/api/v1/flowsReturns all workflows with their status, step counts, and execution statistics.
Get Workflow
GET
/api/v1/flows/{id}Returns full workflow details including step definitions and configuration.
Execution
Execute Workflow
POST
/api/v1/flows/{id}/executeStart a new workflow run with input data.
Request Body:
{
"input_data": {
"message": "I need to renew my trade license",
"citizen_id": "CIT-2024-001"
},
"trigger": "api"
}
Response:
{
"id": "run-a1b2c3",
"flow_id": "f1a2b3c4...",
"flow_name": "Citizen Inquiry Router",
"status": "completed",
"trigger": "api",
"steps": [
{
"step_id": "classify",
"step_name": "Classify Inquiry",
"step_type": "llm_call",
"status": "completed",
"input_data": {"message": "I need to renew my trade license"},
"output_data": {"category": "permit", "confidence": 0.94},
"started_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:01Z",
"duration_ms": 850
}
],
"started_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:02Z",
"duration_ms": 1800
}
List Workflow Runs
GET
/api/v1/flows/{id}/runsReturns execution history for a specific workflow.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Maximum number of runs to return |
Get Run Details
GET
/api/v1/runs/{id}Returns full details for a specific run, including all step inputs, outputs, and timing.
Templates
List Templates
GET
/api/v1/templatesReturns available pre-built workflow templates.
Response:
[
{
"id": "citizen-request",
"name": "Citizen Inquiry Processing",
"description": "Classify, route, and respond to citizen inquiries",
"category": "Government",
"steps_count": 4,
"tags": ["citizen-services"],
"preview_steps": [
{"name": "Classify Inquiry", "type": "llm_call"},
{"name": "Route Request", "type": "conditional"}
]
}
]
Health
Health Check
GET
/api/v1/healthReturns service health status and version information.