Autentizace
Začínáme

Autentizace

Handelsregister AI API podporuje dvě metody autentizace: API klíč a Bearer Token. Obě metody fungují na všech API endpointech.

Metody autentizace

x-api-key: YOUR_API_KEY API klíč přes hlavičku: Doporučeno pro integrace server-to-server a produkční použití
?api_key=YOUR_API_KEY API klíč přes Query parametr: Pouze pro rychlé testování a zpětnou kompatibilitu
Authorization: Bearer YOUR_TOKEN Bearer Token: Nejlepší pro aplikace vyžadující jemnou kontrolu přístupu, vypršení tokenu a zvýšenou bezpečnost

Příklady autentizace API klíčem

Použití x-api-key hlavičky (Doporučeno)
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"

Správa Bearer Tokenů

Vytvořit API token

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"
     }'

Odpověď bude obsahovat váš Bearer token. Uložte jej bezpečně!

Použití Bearer Tokenu

curl -X GET "https://handelsregister.ai/api/v1/search-organizations?q=company" \
     -H "Authorization: Bearer YOUR_API_TOKEN"

Endpointy pro správu tokenů

POST /api/v1/auth/tokens/create Vytvořit nový token
GET /api/v1/auth/tokens Zobrazit všechny tokeny
DELETE /api/v1/auth/tokens/{id} Zrušit konkrétní token
DELETE /api/v1/auth/tokens Zrušit všechny tokeny