Validate an invoice file: UBL or CII XML, or a Factur-X / ZUGFeRD PDF
validate_invoice_xmlValidate an e-invoice FILE the user already has: a UBL 2.1 Invoice, a UBL 2.1 CreditNote, a UN/CEFACT CII CrossIndustryInvoice (invoices and credit notes alike), or a Factur-X or ZUGFeRD PDF. The file is read into the invoice model and EN 16931 plus the CIUS rules (XRechnung UBL and CII, Peppol BIS 3) run over it, returning the same teaching errors as validate_invoice, plus which syntax it read, the document's BT-24/BT-23 and unmapped: everything in the file that did not reach the model. Use it when someone says "this invoice was rejected, why?" and hands you a file. Send the file as-is; do not work out the syntax or the document type first, because the tool decides both and reports them. XML goes in xml, as text. A PDF goes in pdf_base64, as the file's bytes base64-encoded, never pasted as text (the whole call is capped at 1 MB, so about 750 KB of PDF; larger files go to POST /v1/validate as application/pdf). The XML attached to the PDF is judged the same way, and the attachment and XMP metadata are checked too, as AW-PDF-* warnings and information that do not change valid; PDF/A conformance and whether the page agrees with the XML are not checked. Keyless, with no upload: npx @attestwire/en16931 validate invoice.pdf. A credit note is NOT refused — send it exactly like an invoice. It is a pre-flight, not an authority: a file that passes here can still be rejected by KoSIT or by a receiving platform, so say so, and pass on the unmapped list, where an entry of kind "unknown" is content the rules never saw. REQUIRES AN API KEY and costs 1 document.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | An XML file: the complete document, as text — the file contents, not a path. Its root element must be <Invoice> in the UBL Invoice-2 namespace, <CreditNote> in the UBL CreditNote-2 namespace, or <CrossIndustryInvoice> in the UN/CEFACT CII namespace. Exactly one of xml or pdf_base64. | |
| pdf_base64 | No | A Factur-X or ZUGFeRD PDF: the file's bytes, base64-encoded (a data: URL prefix and line breaks are fine). Exactly one of xml or pdf_base64. |