PDF to JSON Schema Extractor avatar

PDF to JSON Schema Extractor

Pricing

Pay per event

Go to Apify Store
PDF to JSON Schema Extractor

PDF to JSON Schema Extractor

Extract typed, validated JSON from clean digital invoices, receipts, statements, and simple tables using a target JSON Schema - honest per-field validation, never fabricated values.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Thomas

Thomas

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

1

Monthly active users

6 days ago

Last modified

Share

Extract structured, typed JSON from your own PDF documents using a target JSON Schema. You define the schema; the actor returns output that conforms to it — invoices, receipts, registers, agreements, filings, forms. Tables are mapped to typed rows (numbers as numbers, booleans as booleans), and every run includes an honest validation report: which fields matched, which are missing, which are low-confidence.

Built for RAG and automation pipelines: the output is a contract, not a text dump.

What this handles — and what it doesn't

Works well on: clean, digitally-generated PDFs with printed label–value fields (colon-separated or column-positioned) and/or tables — invoices, receipts, order confirmations, registers, form summaries — including structured fixed-width statements and ledgers with dashed column separators (e.g., A/R royalty statements: data rows are extracted as typed objects, and interleaved subtotal/"Total for…" rows are automatically excluded). Ruled and unruled tables are both detected. Scanned pages get an OCR fallback.

Not built for: free-flowing prose where values are embedded in sentences; complex multi-section reports with nested or merged tables; poor-quality scans (OCR will flag low confidence, but garbage in limits what any tool can match). On these documents you get an honest result — the fields it can't find are listed as missing in the validation report.

The promise either way: this actor never invents a field it can't find. An out-of-scope document produces missing-field results, not fabricated data.

What makes it different

  • A schema contract, not generic OCR. Generic PDF extractors give you unstructured text or fixed layouts. Here you declare the output shape — typed fields, nested objects, arrays for table rows — and get validated JSON back.
  • Typed table extraction. Detects ruled and unruled (text-aligned) tables, merges split columns, finds the real header row, and returns rows as typed objects matching your schema's array property.
  • Honest output, always. Fields the document doesn't contain are reported as missing — never invented. Every matched field carries a confidence score and the page it came from.
  • Your documents stay yours. First-party files only (your uploads, your URLs). The actor scrapes nothing, calls no external AI service, and your document content never leaves the run.
  • OCR fallback for scanned/image-only pages, on by default.
  • Batch-friendly: pass many document URLs; one output item per document; one bad file never sinks the batch (it becomes a structured error item instead).

How to use

Input is by URL, not drag-and-drop. The actor reads your PDFs from links you provide — there is no file-picker upload in the input form. If your files aren't already at a URL, upload them once to an Apify key-value store (Storage → Key-value stores → upload, then copy each record's URL) or use a signed link from S3/Drive/Dropbox. For AI agents calling this actor as an MCP tool this is zero friction; for a human it's one extra step, shown below.

  1. Put direct URLs to your own PDFs in Document URLs (signed S3/Drive/Dropbox links, or Apify key-value-store record URLs as above).
  2. Paste your Target JSON Schema. Tips:
    • Give each property a title matching the label printed in the document (e.g. "title": "Invoice Number" for a line reading Invoice Number: INV-2041).
    • Use "type": "number", "integer", or "boolean" to get typed values (currency symbols and thousands separators are handled).
    • For tables, use an array property whose items.properties mirror the table's columns.
  3. Run. Each dataset item contains data (your schema, filled), validation (matched / missing / low-confidence fields + JSON-Schema validation result), and page counts.

Works the same when called by an AI agent via Apify's MCP server — the input schema above is the tool contract.

Example

Input document line: Total Amount: $4,850.00 · Schema property: "totalAmount": {"type": "number", "title": "Total Amount"} → Output: "totalAmount": 4850.0, listed in validation.matchedFields with its confidence and page number.

Pricing (pay per event)

Two charges, both flat and disclosed:

  • $0.01 per page processed — charged only for pages that were actually processed successfully.
  • $0.005 actor-start fee per run — this one is charged on every run start, including a run where nothing matches or every document errors. It is the only charge you pay on an unsuccessful run.

One worked example:

A 12-page invoice batch (3 documents, 4 pages each) = 12 page-processed events at $0.01 = $0.12, plus the $0.005 actor-start fee = $0.125 total. A 500-page monthly filing run ≈ $5.00. Compare: subscription document-parsing SaaS starts at ~$39/month regardless of volume.

Use Page range to limit long documents. Failed/corrupt documents produce structured error items and are never charged per-page.

Honest limits

  • Works best on documents with printed label–value pairs and/or tables (invoices, receipts, registers, forms, agreement summaries). It is deterministic — it does not "read" free-flowing prose; a field buried in a paragraph will usually be reported as missing rather than guessed.
  • OCR quality on poor scans limits what can be matched; low-confidence matches are flagged so you can decide.
  • One table per array property (the best match is chosen; its column coverage is reported).

Output shape

{
"status": "OK",
"document": "https://…/invoice.pdf",
"data": { "invoiceNumber": "INV-2041", "totalAmount": 4850.0, "lineItems": [ { "description": "…", "quantity": 2, "unitPrice": 1200.0 } ] },
"validation": {
"schemaValid": true,
"matchedFields": [ { "field": "invoiceNumber", "confidence": 1.0, "page": 1 } ],
"missingFields": [ "poNumber" ],
"lowConfidenceFields": []
},
"pagesProcessed": 4,
"ocrPages": 0
}