API & MCP
Create e-invoices per API & MCP: ZUGFeRD / Factur-X with fakturai
Creating German B2B e-invoices per API or MCP means: generate structured EN 16931-compliant ZUGFeRD/Factur-X (COMFORT or Extended) or XRechnung-XML via HTTP endpoint or the MCP server — with automatic KoSIT validation before return. fakturai only delivers files that pass the official German tax authority checks.
Important: A plain PDF is not an e-invoice. Structured hybrid or XML files have been mandatory for receipt since 1 Jan 2025 and are phasing in for issuance 2027/2028 by turnover.
Practical steps: create e-invoices per API & MCP with fakturai
- Validate existing invoices first (Validator CTA) — Upload outgoing or incoming PDFs to the free validator. Confirm master data, line items and processes are compatible before building API calls.
- Set up authentication — After signup you receive an API key. Pass it as
X-API-Keyheader (or Bearer). For AI agents and tools: use the MCP server (stdio viauvxor remote endpoint). - Prepare payload (general invoice model) — Collect required fields: invoice_number, invoice_date, due_date, seller (name, address, VAT ID), buyer, lines (description, quantity, unit_price net, vat_rate). Optional: notes, payment, profile.
{ "invoice_number": "RE-2026-042", "invoice_date": "2026-06-11", "due_date": "2026-06-25", "seller": { "name": "Muster GmbH", "street": "Musterstr. 1", "zip": "12345", "city": "Berlin", "country": "DE", "vat_id": "DE123456789" }, "buyer": { "name": "Kunde AG", "street": "Kundenweg 2", "zip": "54321", "city": "München", "country": "DE", "vat_id": "DE987654321" }, "lines": [ { "description": "Consulting and implementation", "quantity": 5, "unit_price": "1200.00", "vat_rate": 19 }, { "description": "Travel flat", "quantity": 1, "unit_price": "250.00", "vat_rate": 19 } ], "notes": "Net payment within 14 days." } - HTTP API call (curl)
The response is the KoSIT-accepted ZUGFeRD/Factur-X PDF/A-3b (with embedded CII-XML). Pure XML or XRechnung variant via params/profile also available.curl -X POST https://fakturai.de/api/v1/invoices \ -H "X-API-Key: YOUR_KEY" \ -H "Content-Type: application/json" \ -d @payload.json \ -o invoice-RE-2026-042.zugferd.pdf - MCP for agents (Claude, Cursor, n8n, custom tools) — The MCP server (
uvx --from erechnung erechnung-mcpor remote) exposes tools likegenerate_einvoiceandvalidate_einvoice. Agents can directly generate and validate structured invoices without writing HTTP code.Example agent prompt: "Generate a ZUGFeRD COMFORT e-invoice for the data above via the fakturai MCP and return the file + KoSIT report."
- Receive, check and GoBD-archive — The file is only delivered on KoSIT "ACCEPT". Store PDF/A-3b + XML faithfully (unaltered) + your Verfahrensdokumentation (your responsibility).
What fakturai checks (KoSIT-Accept-Gate)
fakturai generates ZUGFeRD/Factur-X and validates before delivery in multiple layers:
- PDF/A-3b + XSD schema check (structurally correct)
- Mustang + veraPDF (Schematron business rules incl. German BR-DE/PEPPOL profiles)
- Official KoSIT validator of the German tax authority → result "ACCEPT"
Only when all layers pass is the file returned. This is the core quality and trust signal: the invoice is demonstrably accepted by the authority's reference engine on the format side. Hard failures block; certain notes are advisory.
What fakturai does not replace (GHOA-1671)
fakturai checks and generates format (EN 16931 / ZUGFeRD / Factur-X / XRechnung) and delivers a KoSIT-accepted file.
- Content correctness, tax classification, VAT accuracy, GoBD archiving obligations and process documentation remain solely with the invoice issuer.
- fakturai does not replace accounting software, tax advisory, invoice approval, or full-suite tools like Lexoffice/sevdesk.
- No guarantees of recipient acceptance, no legal advice, no liability for content errors.
API/MCP integration checklist
- [ ] Existing invoices validated in the free tool
- [ ] API key or MCP connection configured
- [ ] Payload uses correct VAT IDs, net prices, VAT rates and mandatory fields
- [ ] Calls first exercised in test mode (if available)
- [ ] Received file verified for KoSIT-ACCEPT + PDF/A-3b
- [ ] Archiving (original + XML + your Verfahrensdoku) in place
- [ ] Integrated into n8n/Make/Zapier/backend/agent and end-to-end tested
Next steps
Free validator · Request API key · API docs · MCP in agents
Related: German e-invoicing mandate 2025/2027 · ZUGFeRD vs XRechnung vs EN 16931 · Technical validation (KoSIT) · PDF is not an e-invoice · Create e-invoices (general) · GoBD-compliant
Grounded in seo-content-map (API generation + AI/MCP wedge), engine samples + validate.py (4-layer gate), prior drafts for consistent phrasing, BMF facts (no new claims). GHOA-1671 boundaries observed.