Get started
Authentication
API keys, scopes and short-lived tokens for browsers.
API keys
Every request to https://api.shihab.co.uk/v1 needs an API key in the Authorization header. Keys look like shk_live_ followed by 32 characters. Create, name and revoke them under API keys in the console; we store only a hash and show you the first 8 characters afterwards.
curl https://api.shihab.co.uk/v1/models \
-H "Authorization: Bearer $SHIHAB_API_KEY"A missing, wrong or revoked key returns 401 with missing_api_key, invalid_api_key or revoked_api_key.
Scopes
Each key carries scopes. New keys get all of them; narrow a key to what a service needs.
| Scope | Allows |
|---|---|
| listen | POST /v1/listen |
| transcriptions | /v1/transcriptions |
| stream | WebSocket streaming and POST /v1/auth/grant |
| speak | Text to speech, POST /v1/speak |
| usage:read | GET /v1/usage, GET /v1/balance |
Using a key outside its scopes returns 403 insufficient_scope.
Temporary tokens
Browsers and mobile apps must never hold your API key. Instead, your backend calls POST /v1/auth/grant with a key that has the stream scope and hands the short-lived token (sht_...) to the client. Tokens live 30 to 3,600 seconds (default 60) and can only open streams.
curl https://api.shihab.co.uk/v1/auth/grant \
-H "Authorization: Bearer $SHIHAB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ttl_seconds": 60}'{
"token": "sht_3kQ9vXr2...",
"expires_at": "2026-10-12T12:01:00Z",
"ttl_seconds": 60
}Authenticating WebSockets
The streaming endpoint accepts any one of:
Authorization: Bearer <key or token>header (servers)?token=sht_...in the URL (browsers). The parameter also accepts an API key, for server tools that cannot set headers; never put a key in a web page.Sec-WebSocket-Protocol: token, <key or token>(clients that can set subprotocols but not headers)
An authentication failure closes the socket with code 4001.
Keeping keys safe
Server onlyshk_live_RequiredKeep keys in environment variables or a secret manager, never in front-end code or git.One key per servicescopesOptionalSeparate keys make usage clear in the logs and let you revoke one without touching the rest.Rotate on exposurerevokeOptionalRevoking takes effect immediately. Create the new key first, deploy it, then revoke the old one.
Need help? Email [email protected] or message us on WhatsApp.