Skip to main content
Doclo processes documents through a standardized intermediate representation called DocumentIR. This decouples parsing from extraction, allowing you to use different providers for each step.

Supported Input Formats

Doclo accepts documents in many formats. Provider support varies:
VLM providers support images and PDFs directly, with variations by provider (see table). xAI also supports DOCX, TXT, CSV, and MD files natively. Mistral OCR has the widest format support including LaTeX and Jupyter notebooks. For other Office documents and text formats, use an OCR provider first.

Input Methods

Pass documents to flows using any of these methods:
When using URL input, the URL must be publicly accessible. Doclo’s servers fetch the document directly, so URLs behind authentication or private networks will fail.For sensitive documents, use signed URLs (pre-signed S3 URLs, GCS signed URLs, Azure SAS URLs) that provide temporary public access. Alternatively, use base64 encoding to pass the document content directly without exposing a URL.

Converting Files to Base64

Use the bufferToDataUri utility from @doclo/core:
Or use a simple helper for Node.js:

DocumentIR (Intermediate Representation)

DocumentIR is Doclo’s standard format for representing parsed documents. It preserves structure, layout, and enables citation tracking.

Structure

DocumentIR uses a page-centric format:

Content Formats

DocumentIR supports multiple output formats:
  • Plain text: Line-by-line OCR output with spatial coordinates
  • Markdown: Structured documents with tables, headers, lists preserved
  • HTML: Rich formatting with tables and semantic structure

Layout Preservation

DocumentIR preserves document structure through:
  • Bounding boxes: Every line has (x, y, width, height) coordinates
  • Reading order: Lines are ordered as they should be read
  • Table structure: Markdown/HTML capture tables and columns
  • Semantic structure: Headings, lists, and formatting preserved

Provenance Tracking

DocumentIR tracks metadata about the parsing process:

When to Use OCR vs VLM

Choose your parsing approach based on document characteristics:

Use VLM Direct (No DocumentIR)

VLMs excel when layout context matters:
  • Handwritten forms - VLMs understand spatial relationships between fields and handwriting
  • Photos of documents - Receipts, whiteboards, ID cards captured by phone
  • Varied layouts - When documents come in many different formats/structures
  • Charts and diagrams - Visual elements that need interpretation
  • Quick prototyping - Fastest path to get something working
Pros: Faster (one API call), handles visual complexity, simpler setup Cons: Higher cost per document, may miss dense text blocks

Use OCR → LLM (With DocumentIR)

OCR shines for text-heavy, structured documents:
  • Clean PDFs - Invoices, contracts, reports with consistent formatting
  • Dense text - Multi-page documents where accuracy matters
  • RAG pipelines - When you need to store and search document content
  • Agentic loops - Repeated queries against the same document
  • Citation tracking - When you need to trace extracted values back to source lines
Pros: Maximum text accuracy, lower cost at scale, enables citations, reusable DocumentIR Cons: Slower (two API calls), requires OCR provider setup

Document Lifecycle

  1. Raw Document: PDF, image, or Office document input
  2. DocumentIR: Parsed text with layout (optional - skipped with VLM direct)
  3. Structured JSON: Extracted data matching your schema

Next Steps

Providers

Learn about OCR and LLM providers

Parse Node

Configure document parsing