Run a Workflow

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:

  1. documentId - reference a document already uploaded and processed in your workspace.
  2. document - upload a new file inline (base64 file or url). The file is parsed first and the workflow runs once parsing completes. The optional parameters pages, dataset, metadata, parseVersion, and processingMethod apply to inline uploads only and are rejected when combined with documentId.

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): inputLabel is 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 inputLabel to 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}.

Path Params
string
required
Body Params
inputs
array of objects
required

One entry per document. Every workflow input must receive at least one document; single-document inputs accept exactly one, stack inputs accept one or more (repeat the inputLabel). When the workflow has a single input, inputLabel can be omitted and all entries are assigned to it.

Inputs*
integer

Timeout in seconds for this workflow run.

Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json