Plans API
Create Plan
POST /api/plansDefine a new DAG workflow plan.
Request Body
{
"name": "contract-review",
"description": "Multi-step contract review pipeline",
"steps": [
{
"id": "extract",
"prompt": "Extract key clauses from: {{input.contract}}",
"model": "sonnet"
},
{
"id": "analyze",
"prompt": "Analyze risks in: {{extract.output}}",
"model": "opus",
"dependsOn": ["extract"]
},
{
"id": "report",
"prompt": "Generate report from: {{analyze.output}}",
"model": "sonnet",
"dependsOn": ["analyze"]
}
],
"tags": ["legal", "contract"]
}Response
{
"success": true,
"data": {
"id": "dt_plan_xyz789",
"name": "contract-review",
"description": "Multi-step contract review pipeline",
"steps": [...],
"tags": ["legal", "contract"],
"createdAt": "2026-02-20T10:00:00Z"
}
}Status Code: 201 Created
Get Plan
GET /api/plans/:idRetrieve a plan definition.
List Plans
GET /api/plansQuery Parameters
| Parameter | Type | Description |
|---|---|---|
tags | string | Filter by tags (comma-separated) |
search | string | Search by name or description |
limit | number | Max results (default: 20) |
offset | number | Pagination offset |
Execute Plan
POST /api/plans/:id/executeExecute a plan with input data.
Request Body
{
"input": {
"contract": "Full text of the contract..."
},
"hitl": {
"requiredFor": ["analyze"],
"confidenceThreshold": 0.85,
"timeoutMs": 3600000,
"notifyChannels": ["email", "dashboard"]
},
"options": {
"timeoutMs": 300000,
"dryRun": false
}
}Response
{
"success": true,
"data": {
"id": "dt_exec_abc123",
"planId": "dt_plan_xyz789",
"status": "running",
"progress": {
"total": 3,
"completed": 0,
"running": 1,
"pending": 2,
"failed": 0
},
"startedAt": "2026-02-20T10:00:00Z"
}
}Get Execution Status
GET /api/plans/executions/:idResponse
{
"success": true,
"data": {
"id": "dt_exec_abc123",
"planId": "dt_plan_xyz789",
"status": "completed",
"progress": {
"total": 3,
"completed": 3,
"running": 0,
"pending": 0,
"failed": 0
},
"steps": {
"extract": {
"status": "completed",
"output": "Extracted clauses...",
"startedAt": "2026-02-20T10:00:01Z",
"completedAt": "2026-02-20T10:00:04Z",
"durationMs": 3200,
"usage": { "input": 500, "output": 800 }
},
"analyze": {
"status": "completed",
"output": "Risk analysis results...",
"startedAt": "2026-02-20T10:00:04Z",
"completedAt": "2026-02-20T10:00:10Z",
"durationMs": 5800,
"usage": { "input": 1200, "output": 1500 }
},
"report": {
"status": "completed",
"output": "Executive Summary Report...",
"startedAt": "2026-02-20T10:00:10Z",
"completedAt": "2026-02-20T10:00:13Z",
"durationMs": 3100,
"usage": { "input": 2000, "output": 1200 }
}
},
"usage": {
"input": 3700,
"output": 3500,
"total": 7200,
"totalCost": 0.034
},
"startedAt": "2026-02-20T10:00:00Z",
"completedAt": "2026-02-20T10:00:13Z"
}
}Cancel Execution
DELETE /api/plans/executions/:idCancels a running execution. Completed steps are preserved; running and pending steps are cancelled.
Response
{
"success": true,
"data": {
"id": "dt_exec_abc123",
"status": "cancelled",
"progress": {
"total": 3,
"completed": 1,
"running": 0,
"pending": 0,
"failed": 0,
"cancelled": 2
}
}
}Next Steps
- Templates API -- Template management endpoints
- HITL API -- Approval management endpoints