Skip to main content

Overview

Workflow blocks are the building blocks of document processing pipelines. Each block has specific inputs, outputs, and configuration options.

Block Categories

Blocks are organized into three categories:

Core Blocks

Document (Start)

Document

The entry point for your workflow. Upload documents here for processing.
Outputs: File Configuration: None (just upload your document in Run mode) Supported Formats:
  • PDF documents
  • Images (PNG, JPG, JPEG, GIF, WebP, TIFF, BMP)
  • Microsoft Word (.docx, .doc)
  • Microsoft Excel (.xlsx, .xls)
  • Microsoft PowerPoint (.pptx, .ppt)
Usage:
  • Drag multiple Document blocks for workflows that combine multiple inputs
  • Each Document block can receive one file per workflow run
  • Files are automatically converted to PDF when required by downstream blocks

JSON Input (Start)

JSON Input

Entry point for structured JSON data. Define a schema and pass JSON data when running the workflow.
Outputs: JSON Configuration: Schema Example:
Usage:
  • Use JSON Input blocks to pass structured data into workflows without documents
  • Combine with Document blocks to enrich extractions with external data
  • Connect to Extract blocks as additional context for AI-powered extraction
  • Use with Function or If/Else blocks for data-driven workflow logic
SDK Example:

Note

Note

Add comments and documentation to your workflow.
Inputs: None
Outputs: None
Notes don’t affect workflow execution—they’re purely for documentation. Use them to:
  • Explain complex logic
  • Document configuration choices
  • Leave instructions for teammates

Tool Blocks

Extract

Extract

Extract structured data from documents using a JSON schema.
Inputs: File, plus optional additional inputs (JSON, File) Outputs: JSON (extracted data) Configuration: Schema Example:
Consensus Mode:
When n_consensus > 1, the block runs multiple extractions in parallel and returns the consensus data on output-json-0. Field likelihoods are retained as consensus metadata for review and inspection, not as workflow output handles.
Additional Inputs: You can add named input handles to provide extra context during extraction:
  • JSON inputs: Structured data from other blocks
  • File inputs: Additional reference documents

Parse

Parse

Parse documents into machine-usable JSON with a Pages array.
Inputs: File
Outputs: JSON ({"Pages":[...]})
Configuration: Use Cases:
  • Generate page-by-page JSON content for indexing/RAG pipelines
  • Add parsed page context to Extract as additional JSON input
  • Convert scanned PDFs to machine-usable page content

Split

Split

Split multi-page documents into separate PDFs by subdocument.
Inputs: File (PDF)
Outputs: Multiple File outputs (one per subdocument)
Configuration: Subdocument Example:
Each category creates a separate output handle. Connect downstream blocks to process each category differently.
Non-PDF documents are automatically converted to PDF before splitting.

Classifier

Classifier

Classify documents into one of the predefined categories.
Inputs: File
Outputs: Multiple File outputs (one per category, only the matched category receives the document)
Configuration: Difference from Split: Example:
The AI analyzes the document and routes it to exactly one category. Downstream blocks connected to other categories are skipped.

Edit

Edit

Fill PDF forms using AI with JSON instructions or pre-defined templates.
Inputs:
  • File (document to edit) — only when “Use Template” is off
  • JSON (instructions/data)
Outputs: File (filled document) Configuration: Two Operating Modes:
  1. Document Mode (default): Edit an input document using AI
    • Connect a document from another block (e.g., Start, Split)
    • Provide instructions via the JSON input
    • The AI fills the form fields based on your instructions
  2. Template Mode: Fill a pre-defined template
    • Enable “Use Template” toggle
    • Select a template from your template library
    • No document input required — the template provides the form structure
    • Provide data/instructions via the JSON input
Example Instructions (JSON):
The JSON input provides instructions/data for filling. Connect this to an Extract block’s JSON output for end-to-end automation.

Logic Blocks

Review Gates

Review Gate

Pause a gated block for review and approval.
Review is not a separate workflow block. Configure review on a block that supports review, such as extract, split, classifier, or for_each with map_method: "split_by_key". When the gate predicate fires, that same block enters awaiting_review and a review is created with an opaque review id. Configuration: config.review How It Works:
  1. Add review to the block config.
  2. Choose a predicate such as always, any_required_field_null, or field_confidence_lt.
  3. When the predicate fires, the block pauses at awaiting_review.
  4. A reviewer sees the block output alongside the source document.
  5. The reviewer can approve the inspected version_id, append a corrected version with parent_version_id, or reject through Reviews.
  6. After approval, the selected versions[decision.version_id].snapshot continues through the workflow.
Use Cases:
  • Validate critical extractions before sending to downstream systems
  • Quality control for high-value documents
  • Compliance requirements that mandate human oversight
Example extract gate:
Common extract predicates include always, validation_failed, confidence_lt, any_required_field_null, and field_confidence_lt. For split and split-by-key for_each gates, use split-style predicates such as split_count_neq, any_split_pages_lt, and boundary_confidence_lt.
The review object is actor-neutral: a model output, an agent-created correction, and a human-created correction all use the same versions and decision.version_id shape. There is no separate agent-review configuration on config.review; automated reviewers should create correction versions through client.workflows.reviews.versions.create(...) and then approve or reject through client.workflows.reviews.*.

Function

Function

Execute function code in a sandboxed environment for transformations and validations. The language field currently supports Python.
Inputs: JSON Outputs: JSON (with computed/transformed fields) Configuration: Example:
Available packages: pydantic, pandas, numpy, scipy, duckdb, rapidfuzz, beautifulsoup4, lxml, python-dateutil.
Outbound network access is disabled. Use the api_call block for HTTP requests.
See Functions Documentation for the complete reference.
Use Cases:
  • Restructure flat data into nested objects for downstream systems
  • Select only the fields you need from a large extraction
  • Rename fields to match your API or database schema
  • Prepare data for downstream APIs or databases that expect a specific format
Unmapped fields are excluded from the output. If an input path doesn’t exist, the mapping is skipped without error.

If / Else

If / Else

Route data to different branches based on conditions.
Inputs: JSON
Outputs: Multiple JSON outputs (one per branch: If, Else If, Else)
Configuration: Condition Structure: Each condition can have multiple sub-conditions combined with AND/OR:
Available Operators: How It Works:
  1. Conditions are evaluated in order (If, Else If 1, Else If 2, …)
  2. The first matching condition determines the output branch
  3. Data is routed to exactly one branch
  4. If no conditions match and has_else is true, data goes to the Else branch
  5. Downstream blocks on non-matched branches are skipped
Example Use Cases:
  • Route high-value invoices for additional approval
  • Process documents differently based on vendor country
  • Flag incomplete extractions for review

API Call

API Call

Make HTTP requests to external APIs and use the response in your workflow.
Inputs: JSON (optional request body or parameters) Outputs: JSON (API response) Configuration: Example Configuration:
Use Cases:
  • Validate extracted data against external systems
  • Enrich documents with data from your CRM or ERP
  • Trigger actions in third-party services based on extraction results
  • Look up additional information using extracted identifiers
For POST, PUT, and PATCH requests, the block sends the full input JSON as the request body by default. Add field_mappings to rename or derive top-level request fields from dot paths in the input JSON, then use request_schema to keep only the fields the external API expects.
API Call blocks execute synchronously. For long-running operations, prefer async endpoints or job-based integrations on the external system.

Merge JSON

Merge JSON

Combine multiple JSON objects into a single structured object.
Inputs: Multiple JSON inputs (configurable)
Outputs: JSON (merged object)
Configuration: Example Configuration:
Output Structure: The merged output wraps each input under its named key:
This is useful for:
  • Combining extractions from multiple documents
  • Aggregating data from parallel processing branches
  • Creating comprehensive outputs from Split or Classifier workflows

While Loop

While Loop

Repeat contained blocks until a termination condition is met.
Inputs: JSON or File Outputs: JSON or File (final iteration result) Configuration: How It Works:
  1. Data enters the loop through the left input handle
  2. Contained blocks inside the loop process the data
  3. After each iteration, termination conditions are evaluated
  4. If a condition matches (or max iterations reached), the loop exits
  5. Final output is passed through the right output handle
Termination Conditions: Configure conditions using the same operators as If/Else: Example Configuration:
Loop Context Variables: The loop context template can include these variables:
  • {{iteration_number}} - Current iteration (e.g., “1 of 10”)
  • {{termination_condition_breakdown}} - Detailed evaluation of why the loop continued
  • {{data}} - JSON data from the previous iteration
Use Cases:
  • Iteratively refine extractions until quality thresholds are met
  • Process documents until a specific field value is detected
  • Implement retry logic with conditional exit
The loop always runs at least once. Termination conditions are evaluated after each iteration completes.

For Each

For Each

Process items in parallel and combine results.
Inputs: JSON (array) or File (PDF) Outputs: JSON (combined results) Configuration: Map Methods: Reduce Strategies: Example: Iterate Array Process each line item in an invoice separately:
Example: Split by Page Process a multi-page document one page at a time:
Example: Split by Key Split a document containing multiple invoices by invoice number:
Set "allow_overlap": false only when keyed partitions must be exclusive. The default true allows multiple keyed partitions to include the same page. Add map-phase review to inspect the proposed split boundaries before the for-each body runs:
Iteration Context: Inside the loop, contained blocks can access:
  • {{key}} - The partition key for the current item (page range or semantic key)
  • {{input_json}} - The full input JSON (for iterate_array method)
Use Cases:
  • Extract data from each page of a multi-page document independently
  • Process bundled documents that contain multiple invoices/receipts
  • Apply different logic to each item in an array
  • Batch process documents with parallel execution
For Each processes items sequentially. The reduce phase runs after all iterations complete. Use split_by_key when documents have multiple logical sections that need AI to identify boundaries.

Block I/O Types

Understanding input/output types helps you connect blocks correctly:

Tips for Building Workflows

Identify what data you need at the end, then work backwards to determine which blocks you need.
Instead of computing values after reading workflow results elsewhere, use Function blocks to add totals, percentages, and derived fields directly in the workflow.
When handling different document types, use Classifier to route each document to the appropriate extraction schema before processing.
When handling mixed document bundles (e.g., invoice + contract in one PDF), use Split first, then apply specific Extract schemas to each subdocument.
When processing multiple documents or branches, use Merge JSON to combine all extracted data into a single structured output.
Route data based on extracted values—for example, send high-value invoices to a different API endpoint or flag certain conditions for review.
When a single PDF contains multiple logical documents (like several invoices), use For Each with split_by_key to process each one independently with its own extraction.
When you need to retry or refine processing until a quality threshold is met, use While Loop with termination conditions that check for the desired outcome.
Run your workflow with documents that have missing fields, poor scan quality, or unusual formats to ensure robust handling.