write_facturx.json
The JSON file of the “Factur-X: the electronic invoice” example. The electronic invoice French law has required since September 2026: one file, a page a person reads and the same invoice inside it as XML. Nothing to reconcile afterwards, because there is only ever one invoice.
This file is a request: an application sends it over the network to the server, which creates the PDF and sends it back. It makes the same page as the Rust and Python versions of this example. A request names every file it uses, never its content; the call carries the request and the files together. A font the server already holds, such as DejaVuSans, is named with nothing attached. Send the request to the address the API page gives.
This request names files it does not carry: invoice_xml. Each one travels beside the request, in the same call, as a supplied part named exactly as the request names it here — the description says which name plays which role, so you name your files as you like. A request naming a file the call carries nothing of is refused.
What this example is for
Since 1 September 2026, every business in France registered for VAT has to be able to receive an electronic invoice, and the large and mid-sized ones have to send theirs in that form. Smaller businesses follow on 1 September 2027. An invoice that is only a well-made page stops counting as an invoice, and not issuing one electronically is charged at 50 € an invoice, up to 15 000 € a year.
What this example shows
- One page: the work, the tax at twenty per cent, and five thousand one hundred euros to pay — and the same invoice inside the file, written as the XML that accounting software reads.
- The document saying what it carries: an invoice, Factur-X version 1.0, the Minimum level of detail, attached under factur-x.xml and carried as the document's own data — and any of the five levels of detail, from Minimum to Extended, written the same way.
- Handed to veraPDF, a free program with no hand in writing it, as a file fit for long-term keeping — and the invoice inside it pulled back out and compared with what went in.