Run a workflow on one or more documents. This call returns immediately with a jobId; poll GET /job/{job_id} until the job status is completed, then read the results off the job's outputs field. For production integrations we recommend webhooks instead of polling.
Providing documents
Each entry in inputs supplies exactly one document, in one of two ways:
documentId- reference a document already uploaded and processed in your workspace.document- upload a new file inline (base64fileorurl). The file is parsed first and the workflow runs once parsing completes. The optional parameterspages,dataset,metadata,parseVersion, andprocessingMethodapply to inline uploads only and are rejected when combined withdocumentId.
Matching documents to workflow inputs
A workflow declares one or more named inputs. Each input expects either a single document (exactly one) or a document stack (one or more). How you label your inputs entries depends on how many inputs the workflow has:
- One input (whether a single document or a stack):
inputLabelis optional. Every entry you submit is automatically assigned to that input. To fill a stack, just send multiple entries. - Multiple inputs: every entry must set
inputLabelto the exact label of the workflow input it belongs to. Labels are case-sensitive. Repeat the same label across entries to add several documents to a stack input.
Every workflow input must receive at least one document, and single-document inputs accept exactly one. Requests that omit a required inputLabel, use an unknown label, or leave an input empty are rejected with a 400 error that lists the labels the workflow expects.
Example: workflow with one input
{"inputs": [{"documentId": "abc123"}]}
Example: one stack input, three documents
{"inputs": [
{"documentId": "abc123"},
{"documentId": "def456"},
{"document": {"url": "https://example.com/invoice.pdf"}}
]}
Example: multiple inputs, labels required
{"inputs": [
{"inputLabel": "contract", "documentId": "abc123"},
{"inputLabel": "invoices", "documentId": "def456"},
{"inputLabel": "invoices", "documentId": "ghi789"}
]}
Reading the results
When the job completes, each element of the job's outputs is typed by outputType. For extraction outputs, extraction.items holds one item per document with its documentId, standardizationId, and inline data. When a result is too large to inline, data is null; fetch it with GET /standardization/{standardization_id}.
