{"uid":"cap_qtdC8Obg8rgc-GwkMb2Si","slug":"invoice-to-json-extraction-api-x402-18d69d7d","name":"Invoice to JSON Extraction API (x402)","description":"Invoice-to-JSON, on-chain tools (transaction explainer + payment check, wallet profile, contract ABI, ERC-20 token risk), company contacts and web-to-RAG for AI agents. Pay per call with x402 (USDC on Base). No signup, no API key.","url":"https://freetier-agent-api.pages.dev/api/invoice-json?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"url":{"type":"string","description":"public http(s) URL of a PDF, PNG, JPEG or WebP invoice/receipt (max 8 MB)"},"text":{"type":"string","description":"invoice text instead of a file (max 40,000 chars)"},"mime_type":{"type":"string","description":"POST JSON only: application/pdf, image/png, image/jpeg, image/webp or text/plain"},"file_base64":{"type":"string","description":"POST JSON only: base64 file content"}}},"responseSchema":{"type":"json","example":{"input":"pdf","model":"@cf/mistralai/mistral-small-3.1-24b-instruct","pages":1,"checks":{"due_date_not_before_issue_date":true,"subtotal_plus_vat_equals_total":true,"vat_breakdown_sum_equals_vat_total":true,"line_items_sum_equals_subtotal_or_total":true},"limits":"LLM extraction can misread layouts; check important values (quotes make that quick). Scanned PDFs need image input. Documents are not stored.","totals":{"total":4.11,"subtotal":4.11,"vat_total":0,"amount_due":4.11},"vendor":{"name":"Amazon Web Services, Inc.","address":"410 Terry Ave North Seattle, WA 98109-5210, US"},"missing":["vendor_vat_id"],"sources":[{"url":"https://developers.cloudflare.com/workers-ai/","name":"Cloudflare Workers AI: toMarkdown (PDF text layer), Mistral Small 3.1 24B (OCR of images + field extraction; fallback Llama 3.3 70B / Llama 4 Scout / Gemma 3...","note":"Documents are processed in memory and not stored or logged. No third-party LLM API."}],"currency":"USD","customer":{"name":"iViveLabs Limited","address":"93B Sai Yu Chung Yuen Long, N.T., 0000, HK"},"due_date":"2014-08-03","billed_usd":0.003,"issue_date":"2014-08-03","line_items":[{"quote":"AWS Data Transfer $0.01","amount":0.01,"vat_rate":0,"confidence":0.85,"description":"AWS Data Transfer"}],"text_chars":1839,"document_type":"invoice","vat_breakdown":[{"base":0.01,"rate":0,"quote":"VAT ** $0.00","amount":0,"confidence":0.85}],"invoice_number":"42183017","confidence_method":"Per field: 0.6 if the quote is found verbatim in the document text (+0.3 if the value matches the quote; 0.35 base if the quote is not verbatim), then +0.08/...","overall_confidence":0.94}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0075","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0075/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0075","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0075","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_20DlbM-NpPpTdyenB1v50","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0075","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Extracts structured JSON data from invoices and receipts provided as a PDF, image, or text, including line items, totals, vendor/customer details, and validation checks.","exampleAgentPrompt":"Can you parse this invoice PDF at https://example.com/invoice.pdf and give me the vendor, customer, line items, totals, and due date as structured JSON — and tell me if the math checks out?","exampleUseCases":[{"title":"Automate accounts payable data entry","prompt":"I have a supplier invoice PDF at https://mybucket.s3.amazonaws.com/invoice-2024-09.pdf — can you extract all the details like vendor, line items, subtotal, VAT, and due date into JSON so I can load it into our accounting system?"},{"title":"Validate receipt totals for expense reports","prompt":"Here's a receipt image from our team lunch at https://receipts.mycompany.com/lunch-receipt.jpg — can you parse it and check whether the line items actually add up to the total?"},{"title":"Extract invoice fields from pasted text","prompt":"I've copied the text from an invoice below — can you pull out the invoice number, issue date, due date, vendor name, and amount due as structured JSON? [invoice text here]"}],"resultDescription":"A JSON object containing: document type, vendor and customer name/address, invoice number, issue date, due date, currency, line items with amounts and confidence scores, subtotal, VAT breakdown, total amount due, validation checks (e.g. subtotal+VAT=total), missing fields, overall confidence score, model used, and a note that documents are not stored.","failureModes":["File exceeds 8 MB limit — request rejected","Scanned PDF without image input returns poor extraction quality (text layer absent)","LLM misreads complex or unusual invoice layouts — confidence scores help flag this","Invalid or inaccessible URL returns an error","Unsupported MIME type causes rejection","Payment not completed via x402 results in 402 Payment Required response"],"whenToPreferThis":"Choose this endpoint when you need to extract structured, validated invoice or receipt data from PDFs, images, or raw text without setting up an account or API key, and want per-call micropayment pricing via USDC on Base. It is especially well-suited for AI agents doing automated accounts payable, expense processing, or document ingestion pipelines where privacy matters (documents are not stored).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T12:34:32.291Z","isFirstParty":false,"canonicalSlug":"invoice-to-json-extraction-api-x402-18d69d7d"}