e-Invoice REST API

For developers

The same tools, without the interface.

Every invoicePress plugin also exposes its function as a REST route – on your own WordPress installation, under the shared namespace einvoice/v1. What a visitor normally triggers by drag and drop can be called just as well from a script, a cron job or another system.

The routes

Four endpoints, one namespace.

POST /wp-json/einvoice/v1/render — reads an invoice (ZUGFeRD/Factur-X PDF, CII or UBL XML) and returns the structured view.

POST /wp-json/einvoice/v1/explain — takes a validation report (XML or HTML) and returns the prepared, explained version.

POST /wp-json/einvoice/v1/export — returns the parsed invoice as an Excel file; here the file itself comes back, not a JSON envelope around it.

POST /wp-json/einvoice/v1/convert — takes an e-invoice XML and returns it in the other syntax of the UN/CEFACT family: UBL to CII, or CII to UBL. If it is already in the requested syntax, it comes back unchanged.

Which route is available depends on which plugin is active – the routes come from the plugin itself, not from a separate package. The Validator adds /validate as soon as it is installed; it requires a local Java and KoSIT installation and therefore does not run here.

The same logic as the front end

The routes call exactly the same internal method as the matching AJAX endpoint of the interface – no second, separately maintained code path that could drift apart.

The same rules therefore apply: the file is processed in memory and not stored, no call goes out to a third-party service, and the same daily limit per visitor applies.

Reference data

Code lists and business terms, not only in English.

The European standard EN 16931-1 defines which code lists are permitted for every business term with the data type “Code”. These tables – UN/EDIFACT UNTDID, ISO 3166-1, ISO 4217, UN/ECE Rec. 20 and 21, ICD, EAS, MIME, VATEX and others – are available in prepared form: retrievable as a whole or one at a time, and translated into many European languages instead of English only.

The overview of all tables is on the page Code lists and reference tables (EN 16931).

Straight from PHP

Inside the same WordPress, no route is needed.

For extensions that run on the same installation anyway there is a shorter path: SPEV_Renderer::model() returns the parsed invoice as a nested array – the same structure that produces the view, just without the HTML around it.

On top of that come the filters of the individual plugins, which let you extend tooltips, append whole sections, or set language and date format independently of the page.

Look first, then automate.

The routes do the same as the interface. The quickest way to get a feel for it is to send one of your own invoices through the Viewer.