Factur-X API for Python & Node.js

Factur-X (France) and ZUGFeRD 2.x (Germany) are the same hybrid e-invoice format: a human-readable PDF/A-3 with an embedded machine-readable CII XML (factur-x.xml). Instead of assembling PDF/A-3, XMP metadata and XML yourself, you can send one JSON object to a hosted generator and get back the finished file.

The generator is an Apify actor (pay per document, no subscription). Output of "eInvoice": "zugferd" was checked with a public e-invoice validator: 0 errors, 0 warnings.

Why now: French e-invoicing reform

Check the official timeline at impots.gouv.fr for your own case.

Python

import os, requests

invoice = {
  "eInvoice": "zugferd",          # Factur-X / ZUGFeRD hybrid PDF
  "language": "en",
  "currency": "EUR",
  "taxRate": "20",
  "seller": {"name": "Exemple SAS", "address": "1 rue de la Paix",
             "postalCode": "75002", "city": "Paris", "country": "FR",
             "taxId": "FR12345678901", "email": "factures@exemple.fr"},
  "bank": {"iban": "FR7630006000011234567890189"},
  "invoice": {
    "invoiceNumber": "F-2026-0042", "dueDate": "2026-12-31",
    "serviceDate": "2026-11-27",
    "buyer": {"name": "Client SARL", "address": "5 avenue Foch",
              "postalCode": "69006", "city": "Lyon", "country": "FR"},
    "items": [{"description": "Consulting", "quantity": 3,
               "unit": "day", "unitPrice": 650}]
  }
}

url = ("https://api.apify.com/v2/acts/rm.solutions~invoice-pdf-generator/"
       "run-sync-get-dataset-items")
r = requests.post(url, params={"token": os.environ["APIFY_TOKEN"]},
                  json=invoice, timeout=120)
item = r.json()[0]
pdf = requests.get(item["pdfUrl"]).content
open(item["fileName"], "wb").write(pdf)   # Factur-X PDF/A-3

Node.js (18+, built-in fetch)

import { writeFile } from "node:fs/promises";

const url = "https://api.apify.com/v2/acts/rm.solutions~invoice-pdf-generator/run-sync-get-dataset-items?token=" + process.env.APIFY_TOKEN;
const res = await fetch(url, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(invoice)   // same object as in the Python example
});
const [item] = await res.json();
const pdf = Buffer.from(await (await fetch(item.pdfUrl)).arrayBuffer());
await writeFile(item.fileName, pdf);

Pure XML instead of PDF

Need only the CII XML (e.g. for upload to a platform that accepts CII)? Use "eInvoice": "xrechnung". For German public-sector buyers see XRechnung & ZUGFeRD API.

Batch

Send many invoices in one run and receive one dataset item per invoice. Rows with missing required fields return ok: false with a reason and are not charged. Field details: see the input schema on the actor page.

Self-hosted alternatives

If you prefer a library: factur-x (Python, embeds an existing XML into an existing PDF) or Mustang (Java). The hosted actor is useful when you do not want to maintain PDF/A-3 generation yourself or call it from no-code tools (n8n / Make / Zapier example).