Parse File
The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.
For a deeper guide on how to use the output of this endpoint, jump to Using Parsed Output.
Choosing a target? See Markdown vs Spatial for guidance.
Using Parsed Output
The Parse API returns document content in a structured format that provides both high-level formatted content and detailed block-level information. Understanding how to work with this output will help you get the most value from the parsing service.
Working with Chunks
Each chunk (currently only page-level chunks are supported) contains two key properties:
-
content: A fully formatted representation of the entire chunk in the target format (e.g., markdown). This is ready to use as-is if you need the complete formatted content of a page. -
blocks: An array of individual content blocks that make up the chunk, each with its own formatting, position information, and metadata.
When to use chunk.content vs. chunk.blocks
-
Use
chunk.contentwhen:- You need the complete, properly formatted content of a page, already doing the logical placement of blocks (e.g. grouping markdown sections and placing spatially, etc)
- You want to display or process the document content as a whole (and can just combine all chunk.content values)
- You’re integrating with systems that expect formatted text (e.g., markdown processors)
-
Use
chunk.blockswhen:- You need to work with specific elements of the document (e.g., only tables or figures)
- You need spatial information about where content appears on the page, perhaps to build citation systems
- You’re building a UI that shows or highlights specific document elements
Example: Extracting specific content types
Example: Reconstructing content with custom formatting
Spatial Information
Each block contains spatial information in the form of a polygon (precise outline) and a simplified boundingBox. This information can be used to:
- Highlight specific content in a document viewer
- Create visual overlays on top of the original document
- Understand the reading order and layout of the document
By leveraging both the formatted content and the structured block information, you can build powerful document processing workflows that combine the convenience of formatted text with the precision of block-level access.
Markdown vs Spatial
-
markdown: Clean, logical reading order using true markdown constructs (headings, lists, tables, checkboxes). Supports section-aware chunking and works best for LLMs and RAG.
-
spatial: Layout/position-preserving text that uses markdown elements for block types (e.g. tables, checkboxes) but is not strictly markdown due to tabs/whitespace used to preserve placement. Chunks are page-based only.
-
When to choose markdown:
- Default choice for most documents
- Better for multi‑column layouts (content is linearized into readable paragraphs)
- Enables logical section chunking for improved retrieval
-
When to choose spatial:
- Very messy, scanned, or handwritten docs (e.g. healthcare notes, skewed scans)
- You need a near 1:1 text representation of the original layout
- You rely on spatial consistency or vector/distance‑based clustering across documents
- BOLs and similar scanned logistics documents often perform better
Tip: If unsure, start with
markdown. Switch tospatialif you need layout fidelity or encounter scanned/skewed inputs where reading order is unreliable.
Configuration Options
The Parse API accepts a config object that controls how documents are parsed and processed. Configuration options are organized into several categories:
- Target Format: Output format for parsed content (markdown vs spatial)
- Chunking Strategy: How the document is divided into chunks
- Block Options: Fine-grained control over parsing specific layout types
- Advanced Options: OCR enhancements and page filtering
Target Format
target
Type: "markdown" | "spatial"
Default: "markdown"
Determines how content is extracted and formatted from the document. See Markdown vs Spatial above for detailed guidance on choosing between these options.
Chunking Strategy
chunkingStrategy.type
Type: "page" | "section" | "document"
Default: "page"
Determines the granularity of document chunking.
"page" - Creates a separate chunk for each page of the document. Compatible with both markdown and spatial targets.
"section" - Chunks the document into logical sections based on markdown structure (headings, subheadings). The parser ensures logical groups of content are preserved by never breaking markdown elements across chunks. Only works with target: "markdown". This is ideal for RAG systems where each chunk should be a complete semantic unit.
"document" - Treats the entire document as a single chunk. Use this for small documents or when you have custom downstream chunking requirements.
chunkingStrategy.options
Fine-grained control over chunk sizing. Only applies when using type: "section" with target: "markdown". These options are ignored for "page" and "document" chunking types.
minCharacters (number, default: 500) - The minimum number of characters per chunk. Small sections may be combined to meet this minimum.
maxCharacters (number, default: 5000) - The maximum number of characters per chunk. Long sections will be split at natural boundaries when possible.
Block Options
Fine-grained control over how specific content types are detected and formatted.
Figures
blockOptions.figures.enabled (boolean, default: true) - Enables or disables figure detection and parsing. When enabled, the parser uses a VLM to analyze and extract content from each figure. Note: This adds processing latency, especially for documents with many figures. Disable for fastest processing.
blockOptions.figures.figureImageClippingEnabled (boolean, default: true) - When enabled, extracts figure images from the document and uploads them to blob storage, providing presigned URLs in the output. Each figure is cropped from the page and saved as a PNG.
Tables
blockOptions.tables.targetFormat ("markdown" | "html", default: "markdown") - Controls the output format for tables.
- markdown: Human-readable pipe syntax, works well with LLMs
- html: Preserves complex table structure (merged cells, rowspan, colspan)
blockOptions.tables.tableHeaderContinuationEnabled (boolean, default: false) - When enabled, automatically propagates table headers across page breaks. Useful for long tables spanning multiple pages where headers are only present on the first page.
Text
blockOptions.text.signatureDetectionEnabled (boolean, default: true in API) - Enables advanced signature detection. When enabled, identifies handwritten signatures, initials, and signature blocks in the document.
Advanced Options
advancedOptions.agenticOcrEnabled
Type: boolean
Default: false
Enables agentic OCR - an advanced feature that uses a vision-language model (VLM) to review and correct low-confidence OCR results. The system automatically identifies text regions with low OCR confidence and applies AI-based corrections.
When to enable:
- Handwritten documents or forms
- Poor quality scans
- Historical documents or faded text
- Mixed print and handwritten content
Note: Increases latency, especially when every page is scanned.
advancedOptions.pageRotationEnabled
Type: boolean
Default: true
Enables automatic page rotation detection and correction. The system detects if pages are rotated and automatically rotates them to the correct orientation before parsing.
advancedOptions.pageRanges
Type: Array<{ start: number, end: number }>
Default: [] (all pages)
Specifies which pages of the document to process. Page numbers are 1-based and ranges are inclusive. Ranges can overlap and be in any order - the system automatically merges and sorts them.
- 1-based, inclusive page numbers
- Ranges can overlap or arrive out of order; the platform merges and sorts them automatically
- Omit the field or pass
[]to process the full document (subject to global limits) - You are only billed for pages actually processed
The default page limit is 300, and the maximum document size is 750 pages.
Response Type
You can specify the response type in the responseType query parameter for the Parse File and Get Parser Run endpoints.
json- Returns parsed outputs in the response bodyurl- Return a presigned URL to the parsed content in the response body
Complete Configuration Examples
Example 1: Optimized for RAG Pipeline
Section-based chunking with semantic boundaries:
Example 2: High-Volume Processing (Performance-Optimized)
Performance-optimized configuration for fast, high-volume processing:
Example 3: Complex Legal Documents
Maximum accuracy with signature detection and header continuation:
Example 4: Handwritten Forms
Optimized for handwritten or degraded documents:
Best Practices
Performance Optimization
For fastest processing:
- Disable
agenticOcrEnabled(most significant speedup - avoids AI-based OCR corrections) - Set
figures: { enabled: false }(avoids AI-based figure analysis) - Disable
pageRotationEnabledif all pages are correctly oriented - Use
chunkingStrategy: "document"(fastest) or"page"instead of"section"(section chunking adds CPU overhead during parsing to generate semantic sections)
For highest accuracy:
- Set
target: "markdown"withchunkingStrategy: "section" - Enable
agenticOcrEnabledfor handwritten/degraded documents - Enable
tableHeaderContinuationEnabledfor multi-page tables - Enable
signatureDetectionEnabledfor legal documents
Troubleshooting
Poor quality OCR results
- Enable
agenticOcrEnabled: truefor handwritten/degraded documents - Ensure
pageRotationEnabled: truefor rotated pages - Try
target: "spatial"for very messy or skewed documents
Chunks are too large or too small
- Adjust
minCharactersandmaxCharactersinchunkingStrategy.optionsif you are usingtype: "section"withtarget: "markdown". - Try different chunking types (
pagevssectionvsdocument) - Consider using
pageRangesto process fewer pages per request
Tables not parsing correctly
- Enable
tableHeaderContinuationEnabledfor multi-page tables - Try
targetFormat: "html"for complex table structures - Consider
target: "markdown"for better table structure - Ensure
tables: { enabled: true }in block options
Processing is too slow
Try these optimizations in order of impact:
- Disable
agenticOcrEnabled(most significant speedup - eliminates AI-based corrections) - Set
figures: { enabled: false }(eliminates AI-based figure analysis) - Disable
signatureDetectionEnabled - Use
chunkingStrategy: "document"or"page"instead of"section"(reduces CPU overhead) - Use
pageRangesto process fewer pages
Error Response Format
When an error occurs, the API returns a structured error response with the following fields:
code string
A specific error code that identifies the type of error.
message string
A human-readable description of the error.
requestId string
A unique identifier for the request, useful for troubleshooting.
retryable boolean
Indicates whether retrying the request might succeed.
Custom Error Codes
We provide custom error codes to make it easier for your system to know what happened in case of a failure. There will also be a retryable=true|false field in the response body, but you can also find a breakdown below. Most errors are not retryable and are client errors related to the file provided for parsing.
HTTP error codes
Corresponding http error codes for different types of failures. We generally recommend relying on our custom error codes for programmatic handling.
400 Bad Request
Returned when:
- Required fields are missing (e.g.,
file) fileUrlis not provided in the file object- The provided
fileUrlis invalid - The
configcontains invalid values (e.g., unsupported target format or chunking strategy) - The file type is not supported
- The file size is too large
401 Unauthorized
Returned when:
- The API token is missing
- The API token is invalid
403 Forbidden
Returned when:
- The authenticated workspace doesn’t have permission to use the parse functionality
- The API token doesn’t have sufficient permissions
422 Unprocessable Entity
Returned when:
- The file is corrupt and cannot be parsed
- The file is password protected
- The file could not be converted to PDF
- The system failed to generate the target format
500 Internal Server Error
Returned when:
- An OCR error occurs
- A chunking error occurs
- Any other unexpected error occurs during parsing
Handling Errors
Here are examples of how to handle errors from the Parse API:

