Authentifizierung
Die API unterstützt zwei Authentifizierungsmethoden: API-Key und Bearer-Token. Beide funktionieren an allen Endpunkten.
Authentifizierungsmethoden
x-api-key: YOUR_API_KEY |
API-Key via Header: Empfohlen für Server-zu-Server-Integrationen und den Produktivbetrieb. |
?api_key=YOUR_API_KEY |
API-Key via Query-Parameter: Nur für schnelle Tests und Abwärtskompatibilität — der Key steht dabei sichtbar in der URL. |
Authorization: Bearer YOUR_TOKEN |
Bearer-Token: Ideal, wenn Du feingranulare Rechte, Ablaufdaten oder sofort widerrufbare Zugänge brauchst. |
Beispiele: Authentifizierung mit API-Key
curl -X GET "https://handelsregister.ai/api/v1/search-organizations?q=company" \
-H "x-api-key: YOUR_API_KEY"
# Using query parameter (legacy)
curl "https://handelsregister.ai/api/v1/fetch-organization?api_key=YOUR_API_KEY&q=company"
# Using x-api-key header (recommended)
curl -X GET "https://handelsregister.ai/api/v1/fetch-organization?q=company" \
-H "x-api-key: YOUR_API_KEY"
Bearer-Tokens verwalten
Token erstellen
curl -X POST "https://handelsregister.ai/api/v1/auth/tokens/create" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"token_name": "My Application",
"abilities": ["*"],
"expires_at": "2026-01-01 00:00:00"
}'
Die Antwort enthält Dein Bearer-Token — bewahre es sicher auf.
Token verwenden
curl -X GET "https://handelsregister.ai/api/v1/search-organizations?q=company" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Endpunkte zur Token-Verwaltung
POST /api/v1/auth/tokens/create |
Neues Token erstellen |
GET /api/v1/auth/tokens |
Alle Tokens auflisten |
DELETE /api/v1/auth/tokens/{id} |
Einzelnes Token widerrufen |
DELETE /api/v1/auth/tokens |
Alle Tokens widerrufen |