Create an e-invoice (XML)
create_invoiceBuild e-invoice XML from structured invoice data for EN 16931 CII/UBL, XRechnung, Peppol BIS Billing 3.0, or KSeF FA(3) so software can process new invoices.
Instructions
Builds e-invoice XML from structured invoice data: EN 16931 CII or UBL, XRechnung (CII or UBL) or Peppol BIS Billing 3.0, chosen by format. Use it for a new invoice that software will read. For a printable PDF with the XML inside, use create_invoice_pdf; to change the syntax of an invoice you already have, use convert_invoice. Pass invoice as a JSON object, not a string. Every money field ends in "Minor" and is an integer in minor units (EUR 12.34 = 1234); totals and the VAT breakdown are computed, so do not send them. If fields are missing or wrong it returns an error listing every problem (path, BT id, message) and produces nothing; fix them all and call again. It runs locally and does not send the invoice anywhere. It does not run the official rule sets: call validate_invoice on the XML before it goes out.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | Output syntax. "cii" = UN/CEFACT CII, EN 16931 (Factur-X / ZUGFeRD EN 16931 profile, a.k.a. COMFORT); "cii-extended" = UN/CEFACT CII declared as Factur-X / ZUGFeRD EXTENDED (EN 16931 content only; no EXTENDED-only fields); "ubl" = UBL 2.1 Invoice or CreditNote, EN 16931; "xrechnung-cii" = XRechnung 3.x in CII syntax (German CIUS); "xrechnung-ubl" = XRechnung 3.x in UBL syntax (German CIUS); "peppol-ubl" = Peppol BIS Billing 3.0 (UBL); "ksef-fa3" = Polish KSeF FA(3), PLN domestic invoices only; written and schema-checked, never submitted. | |
| invoice | Yes | The invoice. Required: number, issueDate, currency, seller, buyer, lines. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The e-invoice XML, ready to send or to pass to validate_invoice. | |
| format | Yes | The syntax that was written. | |
| warnings | Yes | Non-fatal findings, e.g. a missing XRechnung precondition. |