Authentication
API key headers, key management, and authentication errors.
Auth headers
Every authenticated request carries your API key in a header. Both conventions are accepted everywhere, on every endpoint. Use whichever your client library already sends:
WebSocket connections authenticate the same way: send the header on the upgrade request. Discovery endpoints (/v1/voices, /v1/languages, /v1/models) are public and need no key.
Managing keys
Keys are created and revoked in the console under API keys. Each key:
- is shown in full exactly once, at creation (we store only a hash)
- draws on the workspace’s plan: concurrency, requests-per-minute and monthly character limits belong to the organization, so every key shares one pool and creating more keys never raises a limit (see Rate limits)
- reports its own usage; the usage page breaks down requests, characters, and audio minutes per key
- can be revoked instantly, without affecting your other keys
- shows when it was last used, so you can tell which key your code is actually sending
A common pattern: one key per environment (prod, staging) or per integration, named accordingly, so usage attribution and revocation stay surgical.
Auth errors
Authentication failures return 401 with a structured body. The message says what went wrong with your request specifically, and reason is the same diagnosis for code:
| Parameter | Type | Default | Description |
|---|---|---|---|
| missing_api_key | 401 | - | We didn’t find a key in xi-api-key or Authorization: Bearer. The message names the near miss when there is one: a different header name (x-api-key), an Authorization header without “Bearer ”, or the key in the URL. |
| invalid_api_key · revoked | 401 | - | The key was real but has been revoked. The message gives its last four characters and when it was revoked. Switch your code to an active key. |
| invalid_api_key · malformed | 401 | - | The value can’t be a Svara key, and the message says why: wrapped in quotes, an unexpanded variable like $SVARA_API_KEY, “Bearer” twice, the masked copy from the keys list, a line break, or the wrong length. |
| invalid_api_key · not_found | 401 | - | Well-formed, but no key matches. Keys are shown once and can’t be recovered; create a new one. |
status keeps the values the official ElevenLabs SDKs expect, so their built-in error handling works unchanged. reason and docs are additions SDKs ignore.
Fixing a 401
Read the message first; it usually names the fix. Then:
- Open API keys. The key your code is meant to use should show a recent Last used. If it says Never, your code is sending a different key. If the page warns that a revoked key is still being used, that’s the one.
- Check the base URL is
https://api.kenpathlabs.com. The console’s own/api/…routes need a signed-in browser session and return 401 to API keys. - Test the key on its own:
curl https://api.kenpathlabs.com/v1/usage -H "xi-api-key: $SVARA_API_KEY"returns your plan and balance when the key is good.