Overview
Chunkr outputs processed documents in a structured JSON format containing chunks, segments, and metadata. Each segment can be formatted as HTML, Markdown, or plain text based on your configuration.Output Structure
The output response follows this structure:Output Response Fields
array
Array of chunks, where segments are grouped according to
chunk_processing.target_length.string
Original filename of the processed document.
integer
Total number of pages in the document.
string
Presigned URL to download the processed PDF file.
Chunk Structure
Each chunk contains:string
Unique identifier for the chunk (UUID).
integer
Total number of tokens in the chunk, calculated using the configured tokenizer.
array
Array of segments contained in this chunk. Segments are never split - they always remain intact.
string
Suggested text for embedding this chunk. Generated by combining content from all segments according to the configured
embed_sources.Example Chunk
Segment Structure
Each segment contains detailed information about a detected document element:string
Unique identifier for the segment (UUID).
enum
Type of segment:
Title, SectionHeader, Text, ListItem, Table, Picture, Caption, Formula, Footnote, PageHeader, PageFooter, or Page.string
Primary formatted content based on the
format setting (HTML or Markdown).string
Raw OCR text content without formatting.
string
HTML formatted content (deprecated - use
content with format: "Html").string
Markdown formatted content (deprecated - use
content with format: "Markdown").string
LLM-generated content if using
strategy: "LLM" or custom prompts.string
Presigned URL to the cropped image if
crop_image is enabled.object
Bounding box coordinates:
{left, top, width, height}.integer
Page number where the segment appears (1-indexed).
float
Width of the page containing this segment.
float
Height of the page containing this segment.
float
Confidence score from the layout analysis model (0-1).
array
Array of OCR results with word-level bounding boxes and confidence scores.
Example Segment
- Text Segment
- Table Segment
- Picture Segment
- Formula Segment
Content Format Options
HTML Format
When configured withformat: "Html":
contentfield contains HTML- Preserves structure with proper tags
- Best for tables and complex layouts
- Can be rendered directly in browsers
Markdown Format
When configured withformat: "Markdown":
contentfield contains Markdown- Human-readable
- Easy to convert to other formats
- Ideal for text-heavy content
Plain Text
Thetext field always contains plain text extracted via OCR:
Accessing Output
Getting Task Results
- REST API
- Python SDK
include_chunks=true- Include full chunk data (default: true)base64_urls=false- Use presigned URLs vs base64 (default: false)
Downloading Files
All file URLs are presigned and expire after a certain time:Export Formats
JSON Export
The default output format:Markdown Export
Combine all Markdown segments:HTML Export
Combine all HTML segments:Embedding-Ready Export
Extract just the embed fields for vector database ingestion:Best Practices
-
Choose the right format for your use case
- HTML for tables, structured content, and web rendering
- Markdown for documentation, text processing, and readability
- Plain text for search indexing and simple analysis
-
Use embed fields for RAG
- Pre-configured based on
embed_sources - Optimized for vector embeddings
- Includes only relevant content
- Pre-configured based on
-
Handle presigned URLs properly
- URLs expire after a set time
- Download and cache files you need to keep
- Don’t store presigned URLs long-term
-
Process chunks efficiently
- Iterate through chunks for large documents
- Use chunk metadata for filtering
- Chunk IDs are stable across requests
-
Leverage segment metadata
- Use
segment_typefor filtering - Check
confidencefor quality control - Use
bboxfor spatial analysis
- Use