OCR API

OCR API for Developers

One endpoint. POST a PDF, get complete Markdown back — simple tables as GFM, and complex table structure preserved as sanitized HTML when GFM would be lossy.

$ curl -X POST https://pdftomarkdown.dev/v1/convert \
  -H "Authorization: Bearer demo_public_key" \
  -H "Content-Type: application/json" \
  -d '{"input":{"pdf_url":"https://pdftomarkdown.dev/samples/invoice.pdf"}}'
{
  "complete": true,
  "markdown": "# CONTOSO LTD.\n\n# INVOICE\n\nINVOICE: INV-100\nDATE: 11/15/2019\nDUE DATE: 12/15/2019\n\n| SALESPERSON | P.O. NUMBER | REQUISITIONER | SHIPPED VIA | F.O.B. POINT | TERMS |\n| --- | --- | --- | --- | --- | --- |\n|  | PO-3333 |  |  |  |  |\n\n| QUANTITY | DESCRIPTION | UNIT PRICE | TOTAL |\n| --- | --- | --- | --- |\n| 1 | Test for 23 fields | $100.00 | $100.00 |\n\nTOTAL DUE: $610.00\n\n> Processed by pdfToMarkdown.dev",
  "pages": 1,
  "request_id": "req_example_invoice"
}

Server-side PDF processing. Review privacy, security, and data retention.

Why this OCR API is different

Most OCR APIs are wrappers around Tesseract. They give you a flat string of text with no structure — no headings, no tables, no formatting. You then have to write post-processing code to reconstruct the document layout.

pdfToMarkdown uses a vision-language model that reads documents the way a human does. It understands that a column of numbers with a header row is a table, that a line in all-caps is a heading, and that a block of indented text is a code sample or list.

The output is structured markdown you can actually use.

What comes out of the API

Send any PDF in, get markdown out:

# Invoice #1042

**Vendor:** Acme Corp
**Date:** 2024-01-15

| Description       | Qty | Unit Price | Total  |
|-------------------|-----|------------|--------|
| API Pro Plan      |   1 |    $299.00 | $299.00|
| Setup fee         |   1 |     $49.00 |  $49.00|

**Subtotal:** $348.00
**Tax (8%):** $27.84
**Total due:** $375.84

Tables stay as tables. Headings stay as headings. Multi-column layouts are linearized intelligently.

Supported document types

The API handles any PDF, but performs especially well on:

  • Invoices and receipts — line items, totals, vendor details extracted cleanly
  • Research and academic papers — equations, citations, multi-column layouts
  • Legal contracts — clause structure, defined terms, signature blocks
  • Financial reports — tables with merged cells, footnotes, appendices
  • Scanned documents — the vision model handles low-resolution and rotated scans

Integration in 60 seconds

No SDKs, no API wrappers, no config files needed:

# Hacker tier — no signup, public demo key, page 1 only
curl -X POST https://pdftomarkdown.dev/v1/convert \
  -H "Authorization: Bearer demo_public_key" \
  -H "Content-Type: application/json" \
  -d '{"input":{"pdf_url":"https://pdftomarkdown.dev/samples/invoice.pdf"}}'

Or from Python with requests:

import requests

response = requests.post(
    "https://pdftomarkdown.dev/v1/convert",
    headers={
        "Authorization": "Bearer demo_public_key",
        "Content-Type": "application/json",
    },
    json={"input": {"pdf_url": "https://pdftomarkdown.dev/samples/invoice.pdf"}},
)
result = response.json()
print(result["markdown"])

Compared to other OCR APIs

Feature pdfToMarkdown Tesseract-based APIs Cloud Vision APIs
Table detection Partial
Markdown output
Free tier, no signup Varies
Multi-page PDFs ✓ (Developer)
Math/equation support Partial

Pricing

Both tiers are free. No credit card required.

Hacker

Free, no signup

  • Public demo key — copy & paste
  • Only page 1 is processed
  • 3 requests/min per IP
  • Watermark in output
View docs →

Developer

Free, GitHub login

  • Personal API key
  • 100 pages/month
  • Multi-page PDFs
  • No watermark
Get API key →

Get your free API key

Free tier — no account needed. It converts page 1 only and adds a watermark. Upgrade to developer to remove the watermark and unlock full multi-page PDFs.