Home / Spain data / Read a Facturae or Factur-X invoice and convert it to JSON

How to read a Facturae or Factur-X invoice and turn it into JSON

An electronic invoice is structured data already: an XML file, or a PDF that carries the XML inside. The hard part is that each standard has its own XML. This page shows how to get any of them into one JSON shape, what the result looks like on a real invoice and what the check does not cover.

Updated 2026-11-25

What the Actor does

E-Invoice to JSON ↗ reads a European e-invoice from a direct link, either a PDF with embedded XML or the XML file itself. It returns parties, lines, VAT breakdown, totals and payment data in one normalised JSON shape, whatever the source standard. It parses the XML: no OCR and no AI.

An optional validation block checks mandatory fields and the arithmetic: net plus VAT equals gross, the lines add up to the totals, and the VAT breakdown matches. For XRechnung it also applies the main XRechnung rules.

Formats it reads

FormatWhere it is usedFile
Facturae 3.xSpainXML
Factur-X / ZUGFeRDFrance, GermanyPDF/A-3 with embedded XML
XRechnung (UBL and CII)GermanyXML
UBL / Peppol BIS 3.0, invoices and credit notesPeppol networkXML
CIIEN 16931 syntaxXML
FatturaPAItalyXML

A plain PDF without embedded XML, such as a scanned invoice, is reported as an error and is not charged.

How to run it

The input has two fields: invoiceUrls, a list of direct links, and validate, which adds the checks. The link must point to the file, not to a page that shows it.

input.json
{
  "invoiceUrls": ["https://raw.githubusercontent.com/ZUGFeRD/mustangproject/master/library/src/test/resources/EN16931_Einfach.pdf"],
  "validate": true
}

Each invoice becomes one item in the dataset. You can download it as JSON, CSV or Excel, or send it on with the Google Sheets or webhook recipes.

A real result

The sample published on this site comes from the input above. That file is a Factur-X / ZUGFeRD test invoice from the open-source Mustang project, not a Facturae. A Facturae file returns the same fields, because the output shape does not depend on the standard.

FieldValue in the sample
standardFactur-X / ZUGFeRD
syntax / profileIdCII / EN 16931
number, typeCode471102, 380
issueDate, currency2024-11-15, EUR
sellerLieferant GmbH, VAT ID DE123456789, München, DE
buyerKunden AG Mitte, Frankfurt, DE
embeddedFilesfactur-x.xml
LineQuantityUnit priceLine totalVAT rate
Trennblätter A4209.90198.0019%
Joghurt Banane505.50275.007%

The arithmetic check, step by step

These are the numbers of the sample, and the relations the validation block checks between them:

  • Lines: 198.00 + 275.00 = 473.00, the lineTotal and net of the invoice.
  • VAT at 7%: base 275.00, tax 19.25. VAT at 19%: base 198.00, tax 37.62. Together, 56.87, the tax total.
  • Gross: 473.00 + 56.87 = 529.87. Nothing prepaid, so payable is 529.87 too.

Everything adds up, so the sample comes back with valid: true and empty errors and warnings. Its note says what kind of check it is: basic business-rule checks (EN 16931 arithmetic and mandatory fields), not a full Schematron validation.

What it does not check

  • It is not a full Schematron validation and not a legal compliance certificate. A pass means the structure and the sums are consistent, nothing more.
  • It does not read scanned or plain PDFs: there is no OCR. Without embedded XML you get an error item, free of charge.
  • It only downloads the links you give it. Files that fail to download or parse are not charged.

Invoices can contain personal data, for example when the buyer is a person. The result stays in your own dataset; delete it when you no longer need it.

Price

$0.01 per invoice read, which is $10.00 per 1,000 invoices. Apify platform usage is billed separately. See the step-by-step guide for the full input and price table.

Questions

Does it read Facturae from Spain?

Yes, Facturae 3.x XML files, as well as Factur-X, ZUGFeRD, XRechnung, UBL/Peppol BIS 3.0, CII and FatturaPA.

Is the sample on this page a Facturae?

No. It is a Factur-X / ZUGFeRD test invoice from the Mustang project. The output fields are the same for every standard.

Does it use OCR or AI?

No. It extracts the XML and parses it, so the values are exactly the ones in the file.

Does a valid result mean the invoice is legally correct?

No. It means mandatory fields are present and the amounts add up. It is not a full Schematron validation or a compliance certificate.

Sources

Keep reading