This reference covers the APIs for managing and executing workflows in Eden-MDBS.
Workflows orchestrate multiple template executions in sequence, enabling complex multi-step operations with conditional logic and data passing between steps.
Create a new workflow definition.
POST /api/v1/workflows
Content-Type: application/json
Authorization: Bearer <token>| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique workflow identifier |
description | string | No | Workflow description |
steps | array | Yes | Array of step definitions |
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique step identifier |
template_id | string | Yes | Template to execute |
params | object | No | Parameters for the template |
condition | string | No | Condition expression for execution |
curl http://{host}:8000/api/v1/workflows \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"id": "user_onboarding",
"description": "Complete user onboarding process",
"steps": [
{
"id": "create_user",
"template_id": "insert_user",
"params": {
"email": "{{input.email}}",
"name": "{{input.name}}"
}
},
{
"id": "create_profile",
"template_id": "insert_profile",
"params": {
"user_id": "{{steps.create_user.result.id}}"
}
}
]
}'{
"status": "success",
"data": {
"id": "user_onboarding",
"description": "Complete user onboarding process",
"steps_count": 2,
"created_at": "2024-01-15T10:30:00Z"
}
}Get all workflows in your organization.
GET /api/v1/workflows
Authorization: Bearer <token>curl http://{host}:8000/api/v1/workflows \
-H "Authorization: Bearer $TOKEN"{
"status": "success",
"data": {
"workflows": [
{
"id": "user_onboarding",
"description": "Complete user onboarding process",
"steps_count": 2,
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "process_order",
"description": "Process order with inventory check",
"steps_count": 4,
"created_at": "2024-01-16T09:00:00Z"
}
]
}
}Get details of a specific workflow.
GET /api/v1/workflows/{id}
Authorization: Bearer <token>curl http://{host}:8000/api/v1/workflows/user_onboarding \
-H "Authorization: Bearer $TOKEN"{
"status": "success",
"data": {
"id": "user_onboarding",
"description": "Complete user onboarding process",
"steps": [
{
"id": "create_user",
"template_id": "insert_user",
"params": {
"email": "{{input.email}}",
"name": "{{input.name}}"
}
},
{
"id": "create_profile",
"template_id": "insert_profile",
"params": {
"user_id": "{{steps.create_user.result.id}}"
}
}
],
"created_at": "2024-01-15T10:30:00Z"
}
}Run a workflow with input parameters.
POST /api/v1/workflows/{id}
Content-Type: application/json
Authorization: Bearer <token>curl http://{host}:8000/api/v1/workflows/user_onboarding \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X POST \
-d '{
"email": "john@example.com",
"name": "John Doe"
}'{
"status": "success",
"data": {
"workflow_id": "user_onboarding",
"execution_id": "550e8400-e29b-41d4-a716-446655440000",
"steps": {
"create_user": {
"status": "completed",
"result": {"id": 123}
},
"create_profile": {
"status": "completed",
"result": {"id": 456}
}
}
}
}{
"status": "error",
"data": {
"workflow_id": "user_onboarding",
"failed_step": "create_profile",
"error": "Foreign key constraint violation",
"completed_steps": ["create_user"],
"skipped_steps": []
}
}Update an existing workflow.
PUT /api/v1/workflows/{id}
Content-Type: application/json
Authorization: Bearer <token>curl http://{host}:8000/api/v1/workflows/user_onboarding \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X PUT \
-d '{
"description": "Updated onboarding workflow",
"steps": [
{
"id": "create_user",
"template_id": "insert_user",
"params": {
"email": "{{input.email}}",
"name": "{{input.name}}",
"status": "active"
}
}
]
}'{
"status": "success",
"data": {
"id": "user_onboarding",
"description": "Updated onboarding workflow",
"updated_at": "2024-01-17T10:30:00Z"
}
}Remove a workflow.
DELETE /api/v1/workflows/{id}
Authorization: Bearer <token>curl http://{host}:8000/api/v1/workflows/user_onboarding \
-H "Authorization: Bearer $TOKEN" \
-X DELETE{
"status": "success",
"data": {
"message": "Workflow deleted successfully"
}
}Reference values from workflow input:
{
"params": {
"email": "{{input.email}}",
"name": "{{input.name}}"
}
}Reference results from previous steps:
{
"params": {
"user_id": "{{steps.create_user.result.id}}",
"order_total": "{{steps.calculate_total.result.total}}"
}
}Check if a previous step succeeded:
{
"condition": "{{steps.previous_step.success}}"
}{
"id": "send_notification",
"template_id": "send_email",
"condition": "{{steps.create_order.success}}",
"params": {
"to": "{{input.email}}"
}
}{
"id": "apply_discount",
"template_id": "update_order",
"condition": "{{steps.check_inventory.result.quantity >= input.quantity}}",
"params": {
"order_id": "{{steps.create_order.result.id}}"
}
}| Operation | Required Access |
|---|---|
| Create workflow | Admin |
| List workflows | Read |
| Get workflow | Read |
| Execute workflow | Based on templates |
| Update workflow | Admin |
| Delete workflow | Admin |
When executing a workflow, you need sufficient access to all templates used in the workflow.
{
"error": "Not found",
"message": "Workflow 'user_onboarding' does not exist"
}{
"error": "Bad Request",
"message": "Template 'insert_user' referenced in step 'create_user' does not exist"
}{
"error": "Bad Request",
"message": "Missing required input parameter: email"
}{
"error": "Workflow failed",
"message": "Step 'create_profile' failed: duplicate key value violates unique constraint",
"details": {
"failed_step": "create_profile",
"completed_steps": ["create_user"]
}
}{
"error": "Bad Request",
"message": "Circular dependency detected in workflow steps"
}Steps execute sequentially in the order defined.
Steps with conditions that evaluate to false are skipped, not failed.
When a step fails, subsequent steps are skipped and the workflow returns an error.
Each step's result is available to subsequent steps via parameter references.