Open-source document extraction API

Reliable document extraction for AI agents.

Give it a file and the fields you want. Get back JSON guaranteed to match your schema — or a precise, structured error. Never silently-wrong data.

Apache-2.0 Runs 100% local — $0 REST + MCP 80 tests passing
§ 01 / DEMO
Live, in your browser

Watch a messy document become schema-valid JSON.

Three real documents, three schemas. Hit Run extraction and watch the six-stage pipeline — only one stage ever touches a model. Everything here runs client-side.

razorpay_receipt.pdfPDF · 1 page
RAZORPAY SOFTWARE PVT LTD Tax Invoice / Receipt ------------------------------------ Payment ID: pay_S6lDhbqEbjQ6Bs Payment Date: 26-05-2025 Course Fee: Rs. 1000 Status: CAPTURED Thank you for your payment.
schema you ask forrequest
{
  "invoice_number": "string",
  "invoice_date": "date",
  "total_amount": "number"
}
01
Ingest
02
Extract text
retry ↻
04
Validate
05
Normalize
06
Ground + score
deterministic · free model call · only paid step
output — validated against schemaJSON
awaiting run

Press Run extraction to send this document through the pipeline.

§ 02 / PROBLEM
The problem

Agents are impressive — until a real PDF hits them.

Hand a model a scanned receipt or a two-column invoice and it will confidently return something. The question is whether you can trust it.

docapi validates every response against yourschema, verifies the values are actually present in the source text, and repairs what code can repair. When it can't comply, it returns a structured error — not a plausible guess your agent will act on.

Hallucinated values
A total or date that reads well but was never in the document.
Half-broken shapes
Missing fields, wrong types, an array where you needed an object.
Silent failure
No error, no flag — just wrong data flowing straight into your pipeline.
§ 03 / RELIABILITY
The reliability engine

Six guarantees between the model and your data.

Every extraction passes through the same checks. None of them are the model grading its own work.

01

Schema validation

Every response is checked against the exact schema you sent. Wrong shape, wrong type, missing field — it never reaches your agent as “probably fine.”

02

Grounding check

Each extracted string is verified to actually appear in the source text. Hallucinated values get flagged and confidence drops — silently-wrong data has nowhere to hide.

03

Long-document chunking

Big docs are split into overlapping windows, extracted, then merged. No silent truncation at the context limit, no quietly dropped pages.

04

Deterministic date repair

Dates are normalized to ISO in code, not by the model. The 26-05-2025 → year-2605 class of bug simply can’t happen.

05

One corrective retry

If validation fails, docapi feeds the precise error back once and retries. If it still can’t comply, you get a structured error — never a guess.

06

Confidence + structured errors

Successful calls carry a confidence signal and grounding warnings. Failures return a typed, machine-readable error your agent can branch on.

§ 04 / INTEGRATE
Agent-native

One core. Three ways to call it.

A REST endpoint, an MCP tool your agent invokes directly, or a Python call. Same engine, same guarantees behind all three.

curl -X POST https://api.docapi.dev/v1/extract \
  -F 'file=@razorpay_receipt.pdf' \
  -F 'schema={"invoice_number":"string",
             "invoice_date":"date",
             "total_amount":"number"}'

"cm-cmt"># → 200 OK
"cm-cmt"># { "data": { ... }, "confidence": 0.98, "warnings": [] }
§ 05 / PIPELINE
How it works

The six-stage pipeline, in order.

Only the understand step can ever cost money or call a network. Everything else is deterministic, local, and free.

01
Ingest
Accept the file. Detect type, page count, and encoding before anything else runs.
free · local
02
Extract text
Pull raw text and layout from the document, with an OCR fallback for scans and images.
free · local
03
Understand
The single model call: map the messy text onto your requested fields. Runs locally via Ollama for $0, or via Claude when you want it.
04
Validate (+ retry)
Check the result against your schema. If it fails, feed the exact error back and retry once — then error out cleanly if needed.
free · local
05
Normalize
Repair dates, numbers, and currency in code. Deterministic, testable, identical every run.
free · local
06
Ground + score
Verify every extracted value is present in the source text, flag anything that isn't, and emit a confidence signal.
free · local
Five of six stages never leave your machine — the model call is the only billable, networked step.
§ 06 / ROADMAP
Roadmap

What's shipped, and what's next.

The reliability engine is here today. Tap any node in the orbit to expand it and trace its connected milestones.

Click a node to explore · auto-orbiting
Extract-to-schema
Local model + dates
MCP tool
Eval + grounding
Claude provider
OCR fallback
Hosted docapi
§ 07 / GET ACCESS
Open-core

Free and local today. Hosted when you need scale.

The open-source core is the whole engine — not a crippled demo. A hosted version is coming for teams that would rather not run a model themselves.

● Available now

Open source

The full reliability engine, Apache-2.0. Clone it, run it, ship it.

  • Apache-2.0 — yours to fork and self-host
  • Runs 100% local via Ollama — $0 per extraction
  • REST API and MCP tool out of the box
  • Schema validation, grounding, date repair, retries
★ Get it on GitHub
○ Coming soon

Hosted docapi

An API key instead of a local model. Auth, metering, and scale — built for production agents.

  • API key instead of running your own model
  • Auth, usage metering, and rate limits
  • Seconds, not minutes, on long documents
  • Same engine, same guarantees, zero ops