Basic Usage
Segment Options
UseSegmentOptions to configure segmentation behavior:
Page-Only Segmentation
To find document boundaries without parsing text, set bothsegmentation_strategy="document_boundary" and granularity="page" inside segmentation_schema. This returns page ranges without Markdown, HTML, or other parsed content. Omitting granularity retains parsing and its charge. Use granularity="block" for boundaries within a page.
See the segmentation recipe for complete examples and pricing. These settings belong inside segmentation_schema, not as top-level SegmentOptions fields.
Checkpoint Reuse
Use checkpoints to avoid re-parsing a document when running segmentation after conversion. First convert withsave_checkpoint=True, then segment using the returned checkpoint_id:
Automatic Checkpoint Reuse
When you don’t passcheckpoint_id, segment() can reuse a checkpoint from your team’s earlier run of the same file with compatible parse settings, so parsing isn’t run or billed again. It doesn’t with max_pages or skip_cache=True. The result’s checkpoint_reused is then True. Otherwise it is None, not False: also when you pass checkpoint_id yourself, and on any result from get_result().
Segmentation Result
The result object contains asegmentation_results object with a segments list. Each segment has name, pages (original, 0-indexed page numbers), and confidence. Block segmentation also provides start_block, end_block, and blocks. Parsed content is available when parsing ran or a parsed checkpoint was reused.
Async Usage
Next Steps
Segmentation Recipe
Learn more about document segmentation patterns and use cases.
Structured Extraction
Extract structured data from documents using JSON schemas.
Document Conversion
Convert documents to Markdown, HTML, JSON, or chunks.