Run document pipelines and agent workflows, then poll execution status
Pipelines
The pipeline endpoints let you run a document through a single document type's pipeline (classify → extract → validate) or run an agent across a set of documents. Executions can be synchronous (wait for result) or asynchronous (poll for status).
Execution Status Object
execution_idstringcontext_idstringagent:<goal> (agent runs).context_display_namestringtenant_idstringstatusstringrunning, completed, failedstepsobject[]Array of step results in execution order.
Step Result
toolstring"classify", "extract", "validate").ordernumberstatusstringsuccess or failedoutputobjecterrorstringduration_msnumberresultobjectinput_filenamestringinput_mime_typestringfile_urlstring/v1/pipeline/executions/{id}/filestarted_atstringcompleted_atstringtotal_msnumberEndpoints
Run Pipeline
POST /v1/pipeline/run
Requires scope: write. Runs a document through a single document type's pipeline.
Sync vs async: Pass sync: true (default) to wait for the result inline. Pass sync: false for queued async execution — use GET /v1/pipeline/executions/{id} to poll.
Request body:
context_idstringrequiredDocument type ID to run the pipeline for (must exist in the system).
inputobjectrequiredInput payload. At minimum: { "data": "<base64>", "mime_type": "image/jpeg", "filename": "doc.jpg" }. Additional fields are passed through to each pipeline step.
tenant_idstringTenant context for model routing and rate limiting.
syncbooleantrue to wait for result (default). false for async — returns immediately with execution_id and status: "running".
webhook_urlstringOptional URL to POST the completed result to. Used with async mode.
Example request:
{
"context_id": "pan_card",
"tenant_id": "acme-corp",
"input": {
"data": "<base64-encoded-image>",
"mime_type": "image/jpeg",
"filename": "pan_front.jpg"
},
"sync": true
}
Example response (200):
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "completed",
"steps": [
{ "tool": "classify", "order": 0, "status": "success", "output": { "document_type": "pan_card", "confidence": 0.98 }, "duration_ms": 320 },
{ "tool": "extract", "order": 1, "status": "success", "output": { "extracted": { "name": "John Doe", "pan_number": "ABCDE1234F" } }, "duration_ms": 850 },
{ "tool": "validate", "order": 2, "status": "success", "output": { "valid": true, "violations": [] }, "duration_ms": 12 }
],
"result": {
"document_type": "pan_card",
"extracted": { "name": "John Doe", "pan_number": "ABCDE1234F" },
"valid": true
},
"total_ms": 1182
}
Async response (200):
{
"execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "running"
}
Composite document types (multi-step parallel pipelines) always run via direct execution regardless of the sync parameter.
Run Agent
POST /v1/agent/run
Requires scope: write. Runs a deployed agent across a set of documents. Performs classification, extraction, validation, and cross-matching across all documents. Supports archive uploads.
Request body:
goalstringrequiredAgent goal identifier. The agent must be deployed.
documentsobject[]Array of document objects. Each: { "data": "<base64>", "mime_type": "image/jpeg", "filename": "..." }. Required unless archive is provided.
archiveobjectZIP/tar archive containing multiple documents. { "data": "<base64>" }. Unpacked automatically; all supported image and PDF files are processed.
tenant_idstringsyncbooleantrue to wait for result (default). false for async execution.
webhook_urlstringOptional webhook URL for async result delivery.
Example request:
{
"goal": "kyc_verification",
"tenant_id": "acme-corp",
"documents": [
{ "data": "<base64>", "mime_type": "image/jpeg", "filename": "pan_card.jpg" },
{ "data": "<base64>", "mime_type": "image/jpeg", "filename": "aadhaar_front.jpg" }
],
"sync": true
}
Response (200):
execution_idstringstatusstringcompleted, failed, or running (async)phasesobject[]Results per document type (one phase per doc type processed).
Phase Result
doc_typestringstatusstringextractedobjectvalidbooleanviolationsobject[]resultobjectFor large document payloads (over ~1.5 MB total base64), the agent run executes synchronously even in async mode.
Get Execution Status
GET /v1/pipeline/executions/{execution_id}
Requires scope: read. Returns the current state of an execution (pipeline or agent run).
execution_idstringrequiredResponse (200): Execution Status object.
Download Execution Input File
GET /v1/pipeline/executions/{execution_id}/file
Requires scope: read. Streams the original input document from storage.
execution_idstringrequiredResponse headers: Content-Disposition: inline; filename="<filename>", Cache-Control: private, max-age=3600.
List Executions
GET /v1/pipeline/executions
Requires scope: read.
Query parameters:
tenant_idstringFilter by tenant.
limitnumberDefault 50, max 200.
pipeline_onlybooleanIf true, excludes agent executions (those with context_id starting with agent:). Default false.
Response (200): Array of Execution Status objects.