Configuring Workflows via API
Configuring Workflows via API
Workflows can be configured programmatically by passing a steps array when you create a workflow, update its draft, or create a version.
Each step has a name, a type, an optional config, and a next array that defines where documents flow after the step completes. The same shape is used in request bodies and in the workflow version responses returned by the API.
Quick Start
The simplest useful workflow extracts structured data from a document:
Every workflow starts with a TRIGGER step followed by a PARSE step. After parsing, you can chain any combination of processing, branching, and validation steps.
Key Concepts
Routing
Each stepβs next array defines where documents flow. For most step types, you only need to specify the target step:
For branching step types, each next entry includes a routing field specific to the step type:
Workflow Patterns
Linear Extraction
The simplest pattern β every step has exactly one downstream step.
Classify and Route
Use a CLASSIFY step to route documents to different extractors based on document type. Each next entryβs classificationId must match a classification ID from the classifierβs config.
First, your classifier defines classifications with stable IDs:
Then the workflow step uses those IDs as classificationId values:
Conditions use classification IDs (e.g. "cls_invoice"), not type strings (e.g. "invoice"). IDs are stable across renames β if you rename a classification type from "invoice" to "billing_invoice", the ID stays the same and routing continues to work.
Split and Route
Use a SPLIT step to break a multi-document file into individual sub-documents and route each one by type. The same ID-based routing rules apply as for CLASSIFY.
Conditional Logic
Use a CONDITIONAL step to route based on extracted data values. Each condition has an id that is referenced by next[].conditionId.
See Formulas for the expression language used in leftOperand and rightOperand.
Validation
Use RULE_VALIDATION to check extracted data against business rules and branch on the result.
See Formulas for the rule expression language and Validation Step for the UI guide.
Step Reference
All processor references (extractor, classifier, splitter) require an explicit version field.
CLASSIFY and SPLIT steps do not support "latest" β you must pin to a specific semver version (e.g. "0.1") or "draft". This is because classification IDs used for routing are tied to a specific versionβs config. If a new version is published with different classifications, routing would break silently.
Trigger
The single entry point for every workflow. Must route to exactly one PARSE step.
Parse
Converts the uploaded file into structured content (OCR, text extraction). Must appear immediately after the trigger.
Optionally configure parsing behavior with parseConfig. See Parse Configuration Options.
Extract
Runs a published extractor against parsed content. Version is required β "latest", "draft", or semver. Can be created without config β next cannot be set until config is provided, and config is required before deploy.
Classify
Routes documents to different downstream steps based on classification. Conditions must reference classification IDs, not type strings. Requires a pinned version β "latest" is not allowed. Can be created without config β next cannot be set until config is provided, and config is required before deploy.
See the Classify and Route pattern above for a complete example.
Split
Splits a multi-document file into sub-documents and routes each one. Same ID-based routing and pinned version rules as CLASSIFY. Can be created without config β next cannot be set until config is provided, and config is required before deploy.
See the Split and Route pattern above for a complete example.
Merge Extract
Combines outputs from multiple upstream extract steps. Use mergeOrder to control how overlapping fields are prioritized.
Conditional
Routes based on extracted data values using if/else logic. See the Conditional Logic pattern above.
For the UI-based version of this step, see Conditional Steps.
Conditional Extract
Chooses which extractor to run based on formula conditions. Each rule pairs a formula with an extractor reference. The last rule must have formula: "TRUE" as a default catch-all to prevent runtime failures when no other rule matches. Can be created without config β next cannot be set until config is provided, and config is required before deploy.
See Formulas for the expression language and Conditional Extraction Step for the UI guide.
Rule Validation
Checks extracted data against boolean rules. Can be created without config β next cannot be set until config is provided, and config is required before deploy. See the Validation pattern above for a complete example.
External Data Validation
Sends extraction data to an external HTTP endpoint for validation. Can be created without config β next cannot be set until config is provided, and config is required before deploy.
See External Data Validation Step for more context.
Human Review
Pauses the workflow for manual review in the dashboard before continuing to downstream steps.
Collect
Joins multiple upstream branches before continuing. Use after CLASSIFY or SPLIT branches to wait for all parallel work to complete.
File Conversion
Converts the file format before downstream processing. Use failureBehavior to control whether conversion failures stop the workflow.
Webhook Response
Terminal step that delivers results to your webhook endpoint. Must not have next.
Related Resources
- Create Workflow β Create a new workflow and initialize its draft
- Update Workflow β Replace the draft step graph
- Create Workflow Version β Publish the draft or deploy explicit steps
- Get Workflow Version β Inspect normalized step definitions
- Formulas β Expression language for conditionals and validation rules
- Webhooks β Configure webhook delivery for workflow results

