Skip to main content

zugferd-client

PyPI version Python Online Validator Live API Health Check Standard Format License: MIT

Der offizielle, leichtgewichtige Python-Client für die E-Rechnung API.

🔍 Kostenloser Online-Validator: Teste und validiere deine ZUGFeRD- & XRechnung-Dateien direkt im Browser ohne Registrierung: e-rechnung-cloud.de/validator

Erstelle, verarbeite und validiere rechtskonforme elektronische Rechnungen nach EN 16931 (ZUGFeRD 2.2 / Factur-X & XRechnung) mit nur 3 Zeilen Python-Code.


📦 Installation

pip install zugferd-client

(Erfordert Python >= 3.8 und hat keine schweren C-Bibliotheks-Abhängigkeiten).


⚡ Schnellstart

Dank des integrierten öffentlichen Test-Keys kannst du sofort ohne API-Key oder Registrierung loslegen:

from zugferd_client import ZugferdClient

# Initialisierung (ohne Argumente wird automatisch der kostenlose Test-Key genutzt)
client = ZugferdClient()

# 1. ZUGFeRD PDF/A-3 Rechnung generieren
pdf_bytes = client.generate_invoice({
    "invoice_number": "RE-2026-001",
    "issue_date": "2026-10-09",
    "seller": {
        "name": "Muster GmbH",
        "street": "Hauptstraße 1",
        "city": "Berlin",
        "zip_code": "10115",
        "country": "DE",
        "vat_id": "DE123456789",
        "iban": "DE12345678901234567890"
    },
    "buyer": {
        "name": "Kunden AG",
        "street": "Nebenstraße 2",
        "city": "München",
        "zip_code": "80331",
        "country": "DE"
    },
    "line_items": [
        {
            "description": "Software-Entwicklung & Beratung",
            "quantity": 10,
            "unit_price": 120.00,
            "tax_rate_percent": 19
        }
    ]
}, output_path="rechnung.pdf")

print("✅ ZUGFeRD-Rechnung erfolgreich gespeichert!")

# 2. Vorhandene Rechnung auf EN 16931 Konformität validieren
report = client.validate("rechnung.pdf")
print("Ist konform:", report.is_valid)
print("Format:", report.format_detected)

🛠️ Funktionen & Methoden

1. Rechnungs-PDF generieren (generate_invoice)

Erstellt ein vollständiges, druckfertiges deutsches Rechnungs-PDF (PDF/A-3) mit unsichtbar eingebetteter factur-x.xml nach europäischer Norm EN 16931.

pdf_bytes = client.generate_invoice(invoice_data, output_path="meine_rechnung.pdf")

2. ZUGFeRD in bestehendes Kunden-PDF einbetten (embed_invoice)

Hast du bereits ein fertiges PDF-Design (z. B. aus InDesign, WeasyPrint oder ReportLab)? Bette das EN 16931 XML verlustfrei ein:

pdf_bytes = client.embed_invoice(
    pdf_file="vorlage.pdf",
    invoice_data=invoice_data,
    output_path="fertige_zugferd_rechnung.pdf"
)

3. XRechnung XML generieren (generate_xrechnung)

Erstellt eine reine EN 16931 XML-Datei (ohne visuelles PDF) – gesetzlich vorgeschrieben für Bundesbehörden und B2G in Deutschland (unterstützt buyer_reference / Leitweg-ID BT-10).

invoice_data["buyer_reference"] = "04011000-1234512345-06"  # Leitweg-ID (BT-10)
xml_string = client.generate_xrechnung(invoice_data, output_path="xrechnung.xml")

4. PDF oder XML validieren (validate)

Prüft PDF/A-3 Konformität, XMP-Metadaten, strukturelle Pflichtknoten und führt eine offizielle XSD-Schemaprüfung durch.

result = client.validate("eingangsrechnung.pdf")

if result.is_valid:
    print(f"Gültige E-Rechnung ({result.format_detected})")
else:
    print("Fehler gefunden:", result.errors)

5. Guthaben abfragen (get_billing_status)

Fragt das verbleibende Dokumenten-Guthaben deines Keys ab:

status = client.get_billing_status()
print(f"Verbleibende Dokumente: {status.credits_remaining}")

🔑 Eigener API-Key & Produktion

Für produktive Rechnungen ohne Test-Wasserzeichen übergibst du deinen persönlichen Key oder setzt die Umgebungsvariable ZUGFERD_API_KEY:

export ZUGFERD_API_KEY="zg_live_..."
client = ZugferdClient(api_key="zg_live_...")


🇬🇧 English Overview & Features

zugferd-client is the official Python SDK for the E-Rechnung API, designed to simplify European e-invoicing compliance under EN 16931:

  • Hybrid PDF/A-3 Generation: Create invoices with embedded factur-x.xml (ZUGFeRD 2.2 / Factur-X) in MINIMUM, BASIC, EN 16931 (COMFORT), or EXTENDED profiles.
  • XRechnung (XML-only): Generate pure CII XML required for German public sector mandates (B2G).
  • Validation Engine: Validate incoming PDF/A-3 and XML invoices against official XSD schemas and EN 16931 business rules.
  • Free Online Validator: Test your invoices instantly in your browser at e-rechnung-cloud.de/validator.
  • Zero Heavy Dependencies: Pure Python package with fast HTTP client and typed models.

📄 Lizenz

MIT License - Siehe LICENSE für Details.


⚖️ Markenhinweis & Disclaimer

ZUGFeRD ist eine eingetragene Marke der AWV e.V. (Arbeitsgemeinschaft für wirtschaftliche Verwaltung e.V.) / FeRD. Dieses Projekt (zugferd-client) ist ein unabhängiges Open-Source-Projekt und steht in keiner geschäftlichen oder offiziellen Verbindung zur AWV e.V. oder dem Forum elektronische Rechnung Deutschland. Die Nennung der Marke erfolgt ausschließlich zur beschreibenden Angabe der Formatkompatibilität im Sinne von § 23 Abs. 1 Nr. 3 MarkenG.

Metadata

Release files for zugferd-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zugferd-client 0.1.1
File Size Uploaded Provenance
zugferd_client-0.1.1.tar.gz 12.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zugferd-client 0.1.1
File Interpreter ABI Platform
zugferd_client-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / zugferd_client-0.1.1.tar.gz

Download URL zugferd_client-0.1.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cef104b69c728fbf1ae8413059ea1a28ff8b3575eb867326ad11b852c10be6da
BLAKE2b-256 checksum
How to use checksums
b61539b242a1bc05cfaaac77c334dda9f34ab9e2c7bd2266453bd57daffbfbfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / zugferd_client-0.1.1-py3-none-any.whl

Download URL zugferd_client-0.1.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08920645d0c2de59f8c8e64724e1ebf01445c75a8e392af32e9e568a1394dfc4
BLAKE2b-256 checksum
How to use checksums
e737077427cea47b4ed60f53abb499e4fa1b0c948f869d7abbfb643e60a144f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for zugferd-client 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page