Skip to content

Authentication

How the platform API key authenticates your calls, and where it goes in each request.

Every call to the speech APIs carries your API key. If you do not have one yet, see API keys.

Where the key goes

The header differs by service. Match it exactly, including capitalisation.

API Transport How the key is sent
Speech to text HTTP and WebSocket X-Api-Key header
Text to speech HTTP X-API-Key header
Text to speech WebSocket auth_token field inside the opening hello frame

Non-streaming transcription

Streaming transcription

The same header goes on the WebSocket upgrade request.

Non-streaming synthesis

Streaming synthesis

This one authenticates in the opening frame rather than a header:

await socket.send(json.dumps({
    "type": "hello",
    "lang": "hi",
    "output_format": "24000:pcm16",
    "auth_token": os.environ["BODHI_API_KEY"],
}))

What the key is not for

Account management, meaning billing, top-ups, usage history, and creating or revoking keys, is handled in the platform app under your login. Those screens are not part of this API and are not authenticated by an API key.

When authentication fails

On transcription, 401 means the key was rejected, 402 means the balance is exhausted, and 403 means the account is inactive or the key lacks the scope. See Status codes for authentication for what to do about each.

Synthesis reports all of those as 401. It does not tell you which one it was, so check the balance and the key’s status in the app if a key you expect to work is refused.

Keep the key server-side. See API keys for obtaining, storing, and rotating one.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close