Read invoice
read_invoiceParse one European or UAE (PINT AE) e-invoice into canonical EN 16931 JSON and validate it against the official rule sets in the same call. Use it when you need the invoice content (seller, buyer, lines, totals, payment) together with the verdict; use validate_invoice for a verdict-only answer, invoice_to_html / invoice_to_csv / invoice_to_datev for renderings. Input: XML (UBL, CII, XRechnung, Peppol BIS 3, UAE PINT AE, FatturaPA, KSeF FA(2)/FA(3)) or a ZUGFeRD/Factur-X hybrid PDF up to 25 MB; plain or scanned PDFs without embedded XML are rejected (no OCR). Returns the parsed invoice, the validation report with fix hints in lang, and timings; an unreadable file returns ok=false with error.code/message/hint instead of raising. A FatturaPA lot returns only its first invoice, with a note. For a Polish KSeF invoice, pass the KSeF number in ksef: it is checked against the invoice and returned on payment.ksef_number. Costs one invoice credit per call; without an API key the anonymous quota is 5 invoices per day per IP (a free key gives 100: https://invoicein.peculiar.systems/#get). Nothing is stored.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_base64": "<file_base64>"
},
"name": "read_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ksef | No | Poland only: the KSeF number the National e-Invoice System gave this invoice — 35 characters, NNNNNNNNNN-RRRRMMDD-FFFFFFFFFFFF-FF — or the collective identifier covering it (NNNNNNNNNN-IZRRRRMM-FFFFFFFFFFFF-FF). KSeF assigns it on acceptance, so it is never inside the FA(2)/FA(3) XML: it arrives beside the invoice in the KSeF API response, the UPO or the QR code on a visualisation. Pass it and it is checked against the invoice and returned on payment.ksef_number, the reference a Polish buyer must quote in the bank transfer title from 2027-01-01. Leave empty for invoices from any other country. | |
| lang | No | Language of the fix hints in the validation report and of the labels in HTML output. Default en. | en |
| file_base64 | Yes | Invoice file content, base64-encoded (standard alphabet). Accepted content: XML in UBL 2.1, CII D16B, XRechnung, Peppol BIS Billing 3, FatturaPA 1.2 or KSeF FA(2)/FA(3) syntax, or a ZUGFeRD 1.0/2.x or Factur-X hybrid PDF (the embedded XML is used). Max 25 MB decoded. The hosted server cannot open files on your machine: read the file and send its bytes here. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | False when the file could not be read; then only `error` is set | |
| note | No | Set when the file is a lot of several invoices: only the first is returned | |
| error | No | Present when ok is false: code, message, hint | |
| source | No | Detected syntax, format, profile and container | |
| credits | No | What this call cost on the hosted server: mode (key or demo) and remaining; without an API key also the daily limit and a note saying where the free key is. Absent when the server runs locally. | |
| invoice | No | Canonical EN 16931 JSON: document, seller, buyer, lines, tax_breakdown, totals, payment, attachments, extensions; field names carry BT/BG numbers in /v1/schema | |
| timings_ms | No | Processing time per stage: detect, map, validate, total | |
| validation | No |