Basic Usage
Conversion Options
UseConvertOptions to control the conversion:
All Options
| Option | Type | Default | Description |
|---|---|---|---|
output_format | str | "markdown" | Output format: "markdown", "html", "json", "chunks" |
mode | str | "fast" | Processing mode: "fast", "balanced", "accurate" |
paginate | bool | False | Add page delimiters to output |
max_pages | int | None | Maximum number of pages to process |
page_range | str | None | Specific pages to process (e.g., "0-5,10,15-20"). For spreadsheets, filters by sheet index. |
skip_cache | bool | False | Skip cached results, force reprocessing |
disable_image_extraction | bool | False | Don’t extract images from document |
disable_image_captions | bool | False | Don’t generate captions for images |
token_efficient_markdown | bool | False | Optimize markdown output for LLM token usage |
fence_synthetic_captions | bool | False | Fence synthetic image captions |
include_markdown_in_chunks | bool | False | Include markdown in chunks/JSON output |
save_checkpoint | bool | False | Save intermediate checkpoint for reuse |
extras | str | None | Comma-separated features: "track_changes", "chart_understanding", "extract_links", "table_row_bboxes", "infographic", "new_block_types" |
add_block_ids | bool | False | Add block IDs to HTML output for citations |
keep_spreadsheet_formatting | bool | False | Preserve spreadsheet styling in HTML output |
webhook_url | str | None | Override account webhook URL for this request |
additional_config | dict | None | Additional configuration options |
Processing Modes
| Mode | Description | Use Case |
|---|---|---|
fast | Lowest latency (default) | Simple documents, real-time applications |
balanced | Balance of speed and accuracy | General use |
accurate | Highest accuracy | Complex layouts, tables, figures |
Output Formats
| Format | Description |
|---|---|
markdown | Clean markdown with headers, lists, tables |
html | Structured HTML preserving layout |
json | Block-level structure with bounding boxes |
chunks | Pre-chunked output for RAG applications |
Conversion Result
TheConversionResult object contains the converted content and metadata:
Result Fields
| Field | Type | Description |
|---|---|---|
success | bool | Whether conversion succeeded |
markdown | str | Markdown output (if format is markdown) |
html | str | HTML output (if format is html) |
json | dict | JSON output (if format is json) |
chunks | dict | Chunked output (if format is chunks) |
images | dict | Extracted images as {filename: base64_data} |
metadata | dict | Document metadata |
page_count | int | Number of pages processed |
parse_quality_score | float | Quality score from 0-5 |
cost_breakdown | dict | Cost details (list_cost_cents, final_cost_cents) |
checkpoint_id | str | Checkpoint ID if save_checkpoint was True |
error | str | Error message if conversion failed |
Saving Output
Save the conversion result to files:document.md(or.html,.jsonbased on format)document_images/directory with extracted images (ifsave_images=True)
Async Usage
For high-throughput applications:Polling Configuration
Control polling behavior for long-running conversions:Special Features
Track Changes (Word Documents)
Extract tracked changes and comments from DOCX files:Chart Understanding
Extract data from charts and graphs:Block IDs for Citations
Add block IDs for tracking content back to source locations:Structured Extraction
For structured data extraction, use the dedicatedclient.extract() method.
Next Steps
Structured Extraction Recipe
Extract structured data from documents using JSON schemas.
Batch Processing
Process multiple documents efficiently in parallel.
Form Filling SDK
Programmatically fill PDF and image forms with field data.
CLI Reference
Convert documents from the command line.