If you've ever tried to generate a Factur-X invoice programmatically, you know the pain. The official libraries are heavy, the documentation is scattered across three different standards bodies, and getting a valid PDF/A-3 with embedded XML is anything but straightforward.
This article shows you how to generate a fully compliant Factur-X invoice in Python in under 20 lines of code - using a free API, no local dependencies, no Java runtime.
What is Factur-X?
Factur-X is a hybrid e-invoice format: a human-readable PDF/A-3 with an embedded CII XML file. It's the standard for electronic invoicing in France and Germany (where it's called ZUGFeRD), and it's becoming mandatory across the EU.
The embedded XML allows accounting software to extract invoice data automatically - no manual data entry, no OCR errors.
The Problem With Existing Solutions
The most common approaches involve:
-
factur-x Python library - requires
ghostscript,pdfrw, and a working LaTeX or WeasyPrint setup - Mustang Java library - requires a JVM, complex Maven setup
- Commercial APIs - β¬99/month minimum
For a quick integration or a small volume use case, none of these are great.
The Solution: XMLBridge API
XMLBridge.com exposes a free REST API that generates valid Factur-X PDF/A-3 files. No API key, no signup, no rate limit for reasonable usage.
Endpoint: POST https://api.xmlbridge.com/generate-facturx
Verify the Output
To confirm the embedded XML is valid, open the PDF in Adobe Acrobat and check the attachments panel - you should see factur-x.xml. You can also drag the PDF into xmlbridge.com/facturx to extract and inspect the embedded XML directly in the browser.
What the API Returns
The API returns a raw PDF binary (application/pdf). The PDF:
- Is PDF/A-3b compliant
- Contains an embedded
factur-x.xml(CII format) - Passes EN 16931 schematron rules
- Is compatible with Chorus Pro (French public procurement platform)
Conclusion
Generating a valid Factur-X invoice doesn't have to involve a 200MB Java dependency or a paid SaaS subscription. For most use cases - freelancers, small businesses, internal tools - a simple HTTP call is all you need.
Try it live at xmlbridge.com/facturx or hit the API directly.
Questions or issues? Drop a comment below.
Top comments (0)