Autenticazione
L'API Handelsregister AI supporta due metodi di autenticazione: Chiave API e Token Bearer. Entrambi i metodi funzionano su tutti gli endpoint dell'API.
Metodi di Autenticazione
x-api-key: YOUR_API_KEY |
Chiave API via Header: Consigliato per integrazioni server-to-server e uso in produzione |
?api_key=YOUR_API_KEY |
Chiave API via Parametro Query: Solo per test rapidi e retrocompatibilità |
Authorization: Bearer YOUR_TOKEN |
Token Bearer: Migliore per applicazioni che richiedono controllo di accesso granulare, scadenza dei token e sicurezza avanzata |
Esempi di Autenticazione con Chiave API
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"
Gestione dei Token Bearer
Creare un Token API
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"
}'
La risposta includerà il tuo token Bearer. Conservalo in modo sicuro!
Utilizzare un Token Bearer
curl -X GET "https://handelsregister.ai/api/v1/search-organizations?q=company" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Endpoint di Gestione Token
POST /api/v1/auth/tokens/create |
Crea nuovo token |
GET /api/v1/auth/tokens |
Elenca tutti i token |
DELETE /api/v1/auth/tokens/{id} |
Revoca token specifico |
DELETE /api/v1/auth/tokens |
Revoca tutti i token |