Reference

OpenAPI Specification

Unsere vollständige API ist als OpenAPI 3.1 Spezifikation verfügbar. Nutze sie für Code-Generierung, API-Clients oder interaktive Dokumentation.

Download

OpenAPI YAML

Menschenlesbar, gut für Git

openapi.yaml

Postman Collection

Direkt in Postman importieren

postman-collection.json

Swagger UI

Interaktiv im Browser

Swagger UI öffnen

API Endpoints

Die wichtigsten Endpoints der invoice.xhub API (Version 1.0.0):

POST/api/v1/invoice/{countryCode}/{format}/generate
E-Invoice GenerierungAuth
POST/api/v1/invoice/parse
E-Invoice ParsingAuth
POST/api/v1/invoice/{countryCode}/validate
Validierung (kostenlos)Public
GET/api/v1/invoice/{countryCode}/formats
Formate pro LandPublic
GET/api/v1/invoice/formats
Alle verfügbaren FormatePublic

Authentifizierung

Bearer Token

Authentifiziere dich mit deinem API Key im Authorization Header:

bash
1Authorization: Bearer sk_live_xxxxxxxxxxxxx
2 
3# Testmodus
4Authorization: Bearer sk_test_xxxxxxxxxxxxx

Live Keys (sk_live_*) sind für Produktionsdaten. Test Keys (sk_test_*) sind für Entwicklung und Tests.

Unterstützte Länder

Die API unterstützt E-Rechnungsformate für folgende Länder:

DE

Deutschland

AT

Österreich

CH

Schweiz

FR

Frankreich

IT

Italien

ES

Spanien

NL

Niederlande

BE

Belgien

PT

Portugal

PL

Polen

CZ

Tschechien

HU

Ungarn

RO

Rumänien

BG

Bulgarien

Vorschau

Auszug aus der OpenAPI Spezifikation:

yaml
1openapi: 3.1.0
2info:
3 title: invoice.xhub API
4 version: 1.0.0
5 description: E-Rechnung API für XRechnung, ZUGFeRD und Peppol
6 
7servers:
8 - url: https://api.invoice.xhub.io/v1
9 description: Production
10 - url: https://sandbox.api.invoice.xhub.io/v1
11 description: Sandbox
12 
13paths:
14 /api/v1/invoice/{countryCode}/{format}/generate:
15 post:
16 summary: Generate E-Invoice
17 description: Erstellt eine E-Rechnung im gewählten Format
18 parameters:
19 - name: countryCode
20 in: path
21 required: true
22 schema:
23 type: string
24 enum: [DE, AT, CH, FR, IT, ES, NL, BE, PT, PL, CZ, HU, RO, BG]
25 - name: format
26 in: path
27 required: true
28 schema:
29 type: string
30 security:
31 - bearerAuth: []
32 # ...
33 
34 /api/v1/invoice/{countryCode}/validate:
35 post:
36 summary: Validate E-Invoice
37 description: Validiert eine E-Rechnung (kostenlos)
38 # ...
39 
40components:
41 securitySchemes:
42 bearerAuth:
43 type: http
44 scheme: bearer
45 description: "API Key (sk_live_* oder sk_test_*)"
46 # ...

Import in API-Clients

Postman

bash
1# Via URL importieren
21. Öffne Postman
32. Klicke auf "Import" (oben links)
43. Wähle "Link" Tab
54. Füge ein: https://api.invoice.xhub.io/openapi.yaml
65. Klicke "Continue" "Import"
7 
8# Alternativ: Collection herunterladen
9curl -O https://api.invoice.xhub.io/postman-collection.json

Insomnia

bash
1# Via URL importieren
21. Öffne Insomnia
32. Application Preferences Data
43. "Import Data" "From URL"
54. URL: https://api.invoice.xhub.io/openapi.yaml
65. "Fetch and Import"

Code-Generierung

Generiere typsichere API-Clients aus der OpenAPI Spezifikation:

bash
1# TypeScript/JavaScript mit openapi-typescript
2npx openapi-typescript https://api.invoice.xhub.io/openapi.yaml -o ./types/api.d.ts
3 
4# Python mit openapi-python-client
5pip install openapi-python-client
6openapi-python-client generate --url https://api.invoice.xhub.io/openapi.yaml
7 
8# Go mit oapi-codegen
9go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
10oapi-codegen -package api https://api.invoice.xhub.io/openapi.yaml > api/api.gen.go

Versionierung

Die OpenAPI Spezifikation wird bei API-Änderungen aktualisiert. Nutze die Versionsnummer in der Spec, um Kompatibilität sicherzustellen. Breaking Changes werden im Changelog angekündigt.