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.json

Postman Collection

Direkt in Postman importieren

postman-collection.json

API Endpoints

Die wichtigsten Endpoints der Invoice-api.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
ValidierungPublic
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: service.invoice-api.xhub.io/openapi.json

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

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://service.invoice-api.xhub.io/docs
65. Klicke "Continue" "Import"
7 
8# Alternativ: Collection herunterladen
9curl -O https://service.invoice-api.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://service.invoice-api.xhub.io/openapi.json
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://service.invoice-api.xhub.io/openapi.json -o ./types/api.d.ts
3 
4# Python mit openapi-python-client
5pip install openapi-python-client
6openapi-python-client generate --url https://service.invoice-api.xhub.io/openapi.json
7 
8# Go mit oapi-codegen
9go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
10oapi-codegen -package api https://service.invoice-api.xhub.io/openapi.json > 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 Changelogangekündigt.