Skip to main content
A completed request can return success=False and error without raising an SDK exception. Check result.success before reading the output.Python SDK 0.5.0 does not download signed regional results automatically. For EU requests, use the REST polling and download flow.

Basic Usage

Segment Options

Use SegmentOptions to configure segmentation behavior:

Page-Only Segmentation

To find document boundaries without parsing text, set both segmentation_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 with save_checkpoint=True, then segment using the returned checkpoint_id:

Automatic Checkpoint Reuse

When you don’t pass checkpoint_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 a segmentation_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.