Validate an EN 16931 e-invoice
validate_invoiceValidate an invoice, given as a JSON object, against EN 16931 and its national CIUS rule sets (XRechnung UBL/CII, Peppol BIS 3.0, Factur-X). Returns every failure as a "teaching error": the official rule id, the business term (BT-/BG-) it constrains, what the regulation actually requires, and a concrete fix. If the user has an invoice FILE, use validate_invoice_xml instead: retyping a file into JSON loses fields and invents others. Validate before generate_invoice, which refuses an invalid invoice. To explain a rule id you already have, use explain_rule: it is free, and validating again to re-read an error costs a document. REQUIRES AN API KEY and costs 1 document against the monthly quota. Without a key, issue_api_key mints a free one, which works only once the user has saved it, configured it on this server and reconnected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice | Yes | The invoice to validate, as an InvoiceInput object. Required: profile (one of en16931, xrechnung-ubl, xrechnung-cii, facturx-en16931, peppol-bis-3, or "auto" to have it chosen from the buyer: its Leitweg-ID, country and electronic address), invoiceNumber, issueDate ("YYYY-MM-DD"), currency (ISO 4217), seller {name, address{city, postalCode, countryCode}}, buyer {name, address{...}}, and lines[] of {id, description, quantity, unitCode, unitPrice, vatCategory, vatRate}. The XRechnung profiles additionally require buyerReference (BT-10), a seller contact {name, phone, email}, and payment instructions — see BR-DE-1/2/5/6/7/15 via the explain_rule tool. A CREDIT NOTE IS THE SAME OBJECT with invoiceTypeCode (BT-3) set to "381": there is no separate tool and no separate shape, the same rules run, and the amounts stay POSITIVE — the type code is what conveys the direction of the money, so negative amounts on a credit note reverse it back into an invoice. Full schema: https://api.attestwire.com/openapi.json |