Document Segmentation
Segmentation splits a PDF that holds several documents into individual documents. It finds each document's page boundaries and partition key (for example an IBAN), and each resulting document is processed separately downstream.
Overview
Segmentation splits a PDF that merges several documents (bank statements, invoices, financial forms) into individual documents. It finds the boundaries between them and creates one file per document.
Page classification only labels the pages of a single document. Segmentation creates new PDF files and keeps a link from each one to the parent file it came from.
Key Concepts
Section Types
Define the categories of documents the segmenter can identify. Each section type has a name and description that guides the AI classification.
Partition Keys
Unique identifiers (like IBAN or account number) used to group pages belonging to the same logical document, even when interleaved.
Confidence Scores
AI confidence (0-1) in segment classification. Configure minimum thresholds to control when automatic segmentation occurs.
Automatic Routing
Segments can be automatically routed to specific extractors based on their type, so each document goes to the extractor built for it.
Use Cases
Bank Statements with Multiple Accounts
Split a combined PDF containing statements for different bank accounts.
Multi-Document Financial Packet
Split a combined document containing different document types.
Result Structure
Segmentation output is returned by GET /api/v1.1/workflow-runs/{run_id} in the segmentation_result object, which holds two views of the same result. Use whichever suits your integration. No extra call is needed.
splits field. For the document grouping, use segmentation_result.sections: one entry per identified document, with the page range of each. Each entry is a document; you group by iterating sections, not by partition.
Per-section view (document grouping)
segmentation_result.sections: one entry per identified document, with the list of pages that belong to it. This is the view to use when you need each document's page range. Adjacent documents of the same type stay separate entries here (the per-page view below cannot distinguish them).
Per-page view
segmentation_result.pages: a flat list with one entry per page, giving the identified section type and the partition identifier (e.g. an IBAN) when one is detected. Convenient for page-level lookups, but it does not preserve document boundaries between adjacent same-type documents; use sections for that.
The same sections shape is also available per node (with the segmenter's confidence and reasoning) on GET /api/v1.1/workflow-runs/{run_id}/node-runs/.
Per-page fields (segmentation_result)
Per-section fields (segmentation_result.sections)
The /node-runs/ endpoint returns the same sections array per segmenter node, together with the segmenter's confidence and reasoning. See the Workflow Runs API reference for the full node object.
How It Works
Segmentation is enabled in document processing workflows. When activated, the segmenter analyzes each page of the document using AI to:
- Classify pages: Identify the document type for each page
- Detect boundaries: Find where one document ends and another begins
- Identify partitions: Group pages by unique identifiers (when configured)
- Create segments: Generate new PDF files for each identified segment
- Route for processing: Send segments to appropriate extractors
API Configuration
When using the Workflow Runs API, the /node-runs/ endpoint returns each segmenter node with both the agent configuration used and the segmentation results.
For a Global (system) Segmenter, config is null and is_global_agent is true; the results block is populated the same way.