{"name":"document-to-json","id":"sfoln/document-to-json","title":"Document Parser – AI PDF & Image to JSON","description":"Extract the fields you name (invoice number, total, date, vendor...) from PDFs, scans and images into JSON with AI. PDF pages with a text layer cost $1 per 1,000; only scanned pages are OCR'd with Mistral ($7 per 1,000). $12 per 1,000 documents extracted.","version":"0.1","status":"ready","family":{"id":"documents-media-ai","name":"Documents & media","description":"PDF and office documents to Markdown or JSON, OCR, audio and podcast transcription, YouTube transcripts, summaries and video metadata.","actors":8},"categories":["AI","DEVELOPER_TOOLS","AUTOMATION"],"availability":"on_request","seoTitle":"Document Parser API – AI PDF & Image to JSON Extraction","seoDescription":"Extract invoice, receipt and contract fields from PDFs, scans and images into JSON with AI. Text-layer PDF pages skip OCR. $12 per 1,000 documents + pages.","summary":"Turn invoices, receipts, contracts, forms, CVs, scientific papers or any other document into the JSON fields you ask for. Give a list of document URLs (PDF, scanned PDF, image, DOCX, PPTX) and either a simple list of field names (invoice_number, total, date, vendor) or a full JSON schema; the Actor reads the document's text and fills the fields with an AI extraction step. PDF pages that already contain text are read straight from the PDF's text layer; only scanned pages, images and office files go to Mistral OCR (tables and layout preserved). One clean record per document, with notes on anything missing or ambiguous. Built for back-office automation, accounting and procurement pipelines, data entry replacement and AI agents.","pricing":{"model":"pay-per-event","currency":"USD","billedBy":"Apify","freePlanMaxItemsPerRun":5,"events":[{"name":"ocr-page","title":"OCR page","description":"Charged once per page processed by Mistral OCR: scanned PDF pages, images, DOCX/PPTX pages, or every page with forceOcr.","priceUsd":0.007},{"name":"pdf-text-page","title":"Text-layer page","description":"Charged once per PDF page read from the PDF's own text layer (born-digital or blank pages): no OCR needed.","priceUsd":0.001},{"name":"document-extraction","title":"Document extraction","description":"Charged once per document whose requested fields were extracted into JSON.","priceUsd":0.012}]},"input":{"description":"List document URLs and the fields you want. Each document produces one dataset record with the extracted fields.","required":["documentUrls"],"fields":[{"name":"documentUrls","title":"Document URLs","type":"array","required":true,"description":"Public URLs of PDFs, scans or images (PNG, JPG, WEBP, TIFF), DOCX or PPTX, one per line. Max 50 MB per file. PDF pages that have a text layer are read directly ($0.001 per page); scanned pages, images and office files are OCR'd ($0.007 per page). Accounts on the Apify free plan can process up to 5 documents per run.","prefill":["https://arxiv.org/pdf/1706.03762v7"],"editor":"stringList"},{"name":"fields","title":"Fields to extract","type":"array","required":false,"description":"Field names, one per line, optionally with a hint after a colon, e.g. \"invoice_number\", \"total: grand total incl. tax\", \"line_items: list of {description, quantity, amount}\". Ignored when a JSON schema is given.","prefill":["title","authors","publication_year","main_contribution: one sentence"],"editor":"stringList"},{"name":"jsonSchema","title":"JSON schema (optional)","type":"object","required":false,"description":"Instead of field names, a JSON schema object for the output, e.g. {\"type\":\"object\",\"properties\":{\"total\":{\"type\":\"number\"}}}.","editor":"json"},{"name":"instructions","title":"Extra instructions","type":"string","required":false,"description":"Optional guidance for the extraction (max 2,000 characters), e.g. \"Amounts are in EUR; dates are day-first\".","editor":"textarea"},{"name":"maxPages","title":"Max pages per document","type":"integer","required":false,"description":"Read at most this many pages per document (each page is charged: text-layer PDF pages $0.001, OCR'd pages $0.007). Accounts on the free plan are limited to 5.","default":20,"prefill":2,"minimum":1,"maximum":100},{"name":"includeMarkdown","title":"Include document markdown","type":"boolean","required":false,"description":"Also return the document's text as markdown, from the PDF's text layer and/or OCR (always included when extraction fails).","default":false},{"name":"forceOcr","title":"OCR every page","type":"boolean","required":false,"description":"Send every PDF page to Mistral OCR, also pages that have a text layer (charged as ocr-page instead of pdf-text-page). Use it when a PDF's text layer is unreliable, e.g. garbled characters or text in the wrong order; scans and images are always OCR'd.","default":false},{"name":"maxDocuments","title":"Max documents","type":"integer","required":false,"description":"Safety cap on how many documents are processed in this run.","default":100,"minimum":1,"maximum":5000},{"name":"concurrency","title":"Concurrency","type":"integer","required":false,"description":"Documents processed in parallel (1–5).","default":2,"minimum":1,"maximum":5}]},"exampleInput":{"documentUrls":["https://arxiv.org/pdf/1706.03762v7"],"fields":["title","authors","publication_year","main_contribution: one sentence"],"maxPages":2},"outputFields":[{"name":"input","type":"string | object","title":"Input","description":"The input item this record corresponds to."},{"name":"status","type":"string","title":"Status","description":"ok | not_found | error | skipped_invalid | skipped_budget | skipped_free_plan"},{"name":"charged","type":"boolean","title":"Charged","description":"Whether the record incurred a charge: document-extraction when the fields were extracted; when the extraction failed, the last page read (pdf-text-page or ocr-page), so billed pages always show. All page charges are in textPagesCharged and ocrPagesCharged."},{"name":"chargedEvent","type":"string | null","title":"Charged event","description":"The record's last charged event: document-extraction, or the page event when the extraction failed."},{"name":"source","type":"string","title":"Source","description":"Upstream data source."},{"name":"fetchedAt","type":"string","title":"Fetched at","description":"ISO timestamp."},{"name":"warnings","type":"array | null","title":"Warnings","description":"Non-fatal problems (pages not reachable, truncation, budget limits)."},{"name":"error","type":"object | null","title":"Error","description":"{ code, message, provider?, status? } when status is not ok."},{"name":"url","type":"string | null","title":"URL","description":"Document URL."},{"name":"docSizeBytes","type":"integer | null","title":"Document size (bytes)","description":"Size the server reported for the document; on skipped_invalid records with error code document_too_large."},{"name":"documentType","type":"string | null","title":"Document type","description":"document (PDF, DOCX, PPTX ...) or image."},{"name":"mode","type":"string | null","title":"Mode","description":"hybrid: a PDF read from its own text layer, only its scanned pages OCR'd; ocr: every page OCR'd (images, office files, forceOcr, or a PDF whose text layer could not be read)."},{"name":"pageCount","type":"integer | null","title":"Pages returned","description":"Pages whose text was used (and charged)."},{"name":"pagesProcessed","type":"integer | null","title":"Pages processed","description":"Pages read: OCR'd by Mistral, or read from the PDF's text layer."},{"name":"pageLimit","type":"integer | null","title":"Page limit","description":"Page cap applied (maxPages, free-plan sample or budget)."},{"name":"possiblyTruncated","type":"boolean | null","title":"Possibly truncated","description":"true when the page limit was reached, so later pages were not read."},{"name":"extracted","type":"object | null","title":"Extracted fields","description":"The requested fields as JSON (null values for fields not found)."},{"name":"confidenceNotes","type":"string | null","title":"Confidence notes","description":"Model notes on missing, ambiguous, inferred or possibly misread fields."},{"name":"extractionStatus","type":"string | null","title":"Extraction status","description":"ok | failed."},{"name":"extractionInputTruncated","type":"boolean | null","title":"Extraction input truncated","description":"true when only the first ≈15,000 tokens of the document text were used for extraction."},{"name":"ocrPagesCharged","type":"integer | null","title":"OCR pages charged","description":"Number of ocr-page events charged for this document."},{"name":"textPagesCharged","type":"integer | null","title":"Text-layer pages charged","description":"Number of pdf-text-page events charged for this document."},{"name":"textLayerPages","type":"array | null","title":"Text-layer pages","description":"Hybrid mode: page numbers read from the PDF's text layer."},{"name":"ocrPages","type":"array | null","title":"OCR pages","description":"Hybrid mode: page numbers sent to OCR (scanned pages)."},{"name":"tokensUsed","type":"object | null","title":"Tokens used","description":"{ input, output } Mistral tokens for the extraction."},{"name":"markdown","type":"string | null","title":"Markdown","description":"The document's text as markdown, from the text layer and/or OCR (includeMarkdown, or when extraction failed)."},{"name":"model","type":"string | null","title":"OCR model","description":"Mistral OCR model used; null when no page needed OCR."}],"outputExample":{"input":"https://files.example.com/invoice-42.pdf","url":"https://files.example.com/invoice-42.pdf","documentType":"document","mode":"hybrid","pageCount":2,"pagesProcessed":2,"pageLimit":2,"possiblyTruncated":false,"extracted":{"invoice_number":"INV-2026-042","date":"2026-10-14","vendor":"Acme GmbH","total":1190,"currency":"EUR"},"confidenceNotes":"Vendor VAT ID not present.","extractionStatus":"ok","extractionInputTruncated":false,"ocrPagesCharged":0,"textPagesCharged":2,"textLayerPages":[1,2],"ocrPages":[],"tokensUsed":{"input":1450,"output":80},"model":null,"status":"ok","charged":true,"chargedEvent":"document-extraction","source":"mistral","fetchedAt":"2026-10-14T10:00:00.000Z"},"faq":[{"question":"Which pages are OCR'd, and what do pages cost?","answer":"PDF pages that already contain text (exported from accounting software, Word or a browser) are read straight from the PDF's text layer for $0.001 per page (pdf-text-page). Only pages without a usable text layer, such as scans and photos, and images or office files go to Mistral OCR for $0.007 per page (ocr-page). Set forceOcr to OCR every page."},{"question":"What if a field is not in the document?","answer":"It is returned as null, never invented, and confidenceNotes says which fields were missing, ambiguous or inferred. When the reply contains none of your fields, the record has extractionStatus failed, carries the document's markdown and the document-extraction event is not charged."},{"question":"Can I use my own JSON schema?","answer":"Yes: pass a JSON schema object in jsonSchema instead of a field list. Every top-level property of the schema is present in extracted (null when not found); the schema guides the model, and values are not validated against its types."}],"mcpExamplePrompt":null,"related":["pdf-ocr-markdown","ai-web-scraper","pdf-text-extractor","document-to-markdown","audio-transcription"],"urls":{"site":"https://www.sfoln.com/actors/document-to-json/","siteJson":"https://www.sfoln.com/actors/document-to-json.json","siteMarkdown":"https://www.sfoln.com/actors/document-to-json.md","runSync":"https://api.apify.com/v2/actors/sfoln~document-to-json/run-sync-get-dataset-items","runAsync":"https://api.apify.com/v2/actors/sfoln~document-to-json/runs","mcp":"https://mcp.apify.com?tools=sfoln/document-to-json","requestAccess":"mailto:contact@sfoln.com?subject=Access%20request%3A%20Document%20Parser%20%E2%80%93%20AI%20PDF%20%26%20Image%20to%20JSON%20(sfoln%2Fdocument-to-json)&body=Please%20publish%20document-to-json.%20What%20we%20plan%20to%20use%20it%20for%3A"},"publisher":{"name":"SFOLN LLC","apifyUsername":"sfoln","url":"https://www.sfoln.com","apifyProfile":"https://apify.com/sfoln","email":"contact@sfoln.com"},"generatedAt":"2026-10-22T04:28:58.477Z"}