Document to JSON — PDF, Invoice & Table Extractor avatar

Document to JSON — PDF, Invoice & Table Extractor

Pricing

from $1.60 / 1,000 page of texts

Go to Apify Store
Document to JSON — PDF, Invoice & Table Extractor

Document to JSON — PDF, Invoice & Table Extractor

Turn PDFs, scans and photos (invoices, receipts, bank statements, forms, tables) into text or structured JSON. Input: document URLs, plus optional field names or a JSON schema. Output: one row per document with page text, or with fields and tables as JSON.

Pricing

from $1.60 / 1,000 page of texts

Rating

0.0

(0)

Developer

Istmobot

Istmobot

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

8 days ago

Last modified

Features

Limited permissions

Share

Turn PDFs, scans and photos into data you can use. Give the Actor links to invoices, receipts, bank statements, purchase orders, forms, menus or reports, and get back either the text of every page or structured JSON with fields and tables. No templates, no training, no OCR setup.

What is Document to JSON?

It reads documents from public URLs and returns one dataset row per document. It has two modes:

  • Text mode: the text of each PDF page. Fast and very cheap. For PDFs that have a text layer.
  • Structured mode: fields and tables as JSON, read with AI. It also reads scans, photos and handwriting, in any language.

Typical uses:

  • Accounts payable: invoice number, dates, vendor, totals, tax and line items from supplier invoices.
  • Expense reports: merchant, date, total and currency from photos of receipts.
  • Bank and card statements: every transaction as a table row.
  • Forms and contracts: the fields you name, as clean keys.
  • Feeding an LLM or a search index: page text of large PDF sets.

What data can I get?

FieldMeaning
urlThe document you sent
fileTypepdf, png, jpeg, webp or gif, detected from the file itself
pagesPages in the document (images count as 1)
pagesProcessedPages read and charged
truncatedtrue when the document has more pages than were read
text, pageTextsText mode: the whole text, and one text per page
dataStructured mode: the extracted JSON (see below)
error, errorCodePresent only on failed documents, which are free

In structured mode with no fields chosen, data holds:

KeyMeaning
documentTypeFor example invoice, receipt, bank statement
languageISO 639-1 code of the main language
summaryOne or two sentences about the document
fieldsEvery labelled value as snake_case: value, copied as written
tablesEvery table: title, columns and rows (one object per row, keyed by column)

When you set Fields to extract or a JSON schema, data has exactly your keys.

How much does it cost?

Pay-per-event pricing. You pay only for pages that were read successfully.

EventPrice
Actor start$0.005 per run
page-text (text mode, per page)$0.002
page-structured (structured mode, per page)$0.01

Examples: 1,000 one-page invoices as structured JSON cost about $10. The text of a 200-page PDF set costs about $0.40.

Failed documents (bad link, unsupported file, unreadable PDF) are never charged. Set a maximum cost per run and the Actor stops cleanly when it is reached. On the Apify free plan, structured mode reads the first 3 pages of each run so you can try it.

How to use Document to JSON

  1. Click Try for free.
  2. Paste one or more document URLs.
  3. Choose text or structured.
  4. Optional, structured mode: name the fields you want, or paste a JSON schema.
  5. Click Start and download the dataset as JSON, CSV or Excel, or read it through the API.

⬇️ Input

{
"documents": ["https://example.com/invoices/INV-2026-0418.pdf"],
"mode": "structured",
"fields": [
"invoice_number: the invoice number",
"issue_date: issue date as YYYY-MM-DD",
"vendor_name: who issued the invoice",
"total: total amount due, number only",
"currency: ISO currency code"
],
"maxPagesPerDocument": 5
}
FieldDefaultDescription
documentsrequiredPublic URLs of PDF, PNG, JPG, WEBP or GIF files. PDFs up to 20 MB, images up to 3.7 MB
modetexttext or structured
maxPagesPerDocument10Pages read per document. Structured mode reads at most 20
fieldsemptyStructured mode. Lines of name: description. Each comes back as text or null
jsonSchemaemptyStructured mode. A JSON schema for nested output such as line items. Overrides fields
instructionsemptyStructured mode. Formatting hints, e.g. "Dates as YYYY-MM-DD"

⬆️ Output

Structured mode, no fields chosen:

{
"url": "https://example.com/invoices/INV-2026-0418.pdf",
"fileType": "pdf",
"pages": 2,
"pagesProcessed": 2,
"truncated": false,
"data": {
"documentType": "invoice",
"language": "en",
"summary": "Invoice from Northwind Data Services Ltd. to Acme Retail GmbH with a total due of 979.70 EUR including 23% VAT.",
"fields": {
"invoice_number": "INV-2026-0418",
"issue_date": "2026-11-03",
"due_date": "2026-12-03",
"seller_name": "Northwind Data Services Ltd.",
"subtotal": "796.50 EUR",
"vat_amount": "183.20 EUR",
"total_due": "979.70 EUR",
"iban": "IE29 AIBK 9311 5212 3456 78"
},
"tables": [
{
"title": "Invoice line items",
"columns": ["Description", "Qty", "Unit price", "Amount"],
"rows": [
{ "Description": "Web scraping setup", "Qty": "1", "Unit price": "450.00", "Amount": "450.00" },
{ "Description": "Monthly data feed (November)", "Qty": "2", "Unit price": "120.00", "Amount": "240.00" }
]
}
]
}
}

Error items

A document that cannot be processed comes out as a free row:

{ "url": "https://example.com/page.html", "errorCode": "UNSUPPORTED_FILE", "error": "Not a PDF, PNG, JPG, WEBP or GIF file (the link may point to a web page)." }
errorCodeMeaning
INVALID_URL, DOWNLOAD_FAILEDThe link is wrong, private or the server refused it
UNSUPPORTED_FILEThe file is not a PDF or a supported image
FILE_TOO_LARGEOver 20 MB (PDF) or 3.7 MB (image)
UNREADABLE_PDFDamaged or password-protected
NO_TEXT_LAYER, NEEDS_STRUCTURED_MODEText mode got a scan or an image: use structured mode
EXTRACTION_FAILEDThe document could not be read; try fewer pages per document

Integrations & API

curl -X POST "https://api.apify.com/v2/acts/istmobot~document-to-json/run-sync-get-dataset-items?token=YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documents":["https://example.com/invoice.pdf"],"mode":"structured"}'
from apify_client import ApifyClient
client = ApifyClient("YOUR_TOKEN")
run = client.actor("istmobot/document-to-json").call(run_input={
"documents": ["https://example.com/invoice.pdf"],
"mode": "structured",
})
for doc in client.dataset(run["defaultDatasetId"]).iterate_items():
print(doc["data"]["fields"])

Works with Make, Zapier and n8n through the Apify apps, and with webhooks: start a run whenever a new file lands in your storage, and send the JSON to your accounting tool or spreadsheet.

🤖 Use with AI agents (MCP)

Add the Actor to any MCP client with https://mcp.apify.com?tools=istmobot/document-to-json. Example prompt: "Read this invoice PDF and give me the vendor, total and line items."

❓ FAQ

Does it read scans and photos? Yes, in structured mode. Text mode needs a PDF with a text layer and tells you when a file has none.

Which languages work? Structured mode reads documents in most languages and keeps values as written. Field names in the default output are in English.

Are values changed or guessed? No. Values are copied as written in the document. A field the document does not contain comes back as null. Always review amounts before you post them to a ledger.

How do I get line items as typed numbers? Use jsonSchema with an items array and number types, and add an instruction such as "Amounts as numbers with a dot as decimal separator".

How many pages can one document have? Any number in text mode. Structured mode reads the first 20 pages of each document; split longer files.

Is my document stored? The file is downloaded for the run, read, and not kept by the Actor. Results stay in your own Apify dataset under your retention settings. Structured mode sends the pages to Anthropic's Claude API for reading.

Can it read private files? The URL must be reachable without login. Use a signed or temporary link from your storage.

Your feedback

Found a document it reads badly, or need another format? Open an issue on the Actor's Issues tab and attach an example if you can.