> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Authentication
description: How Vakyam API keys work and how to send them.
---

# Authentication

All requests to the Vakyam API are authenticated with an API key passed as a
Bearer token in the `Authorization` header.

```text
Authorization: Bearer vak_live_<key>
```

> **Warning:**
> Your API key grants full access to your account's synthesis and credits. Keep it
> secret, never commit it to source control, and prefer loading it from an
> environment variable such as `VAKYAM_API_KEY`.

## Get your API key

Create and manage API keys from the
[Vakyam dashboard](https://dashboard.vakyam.ai/api-keys).
A key is shown only once at creation, so copy it somewhere safe.

## Sending the key

#### Python

```python
from vakyamai import VakyamAI

# Reads VAKYAM_API_KEY from the environment
client = VakyamAI()

# ...or pass it explicitly
client = VakyamAI(api_key="vak_live_...")
```



#### JavaScript

```ts
import { VakyamAI } from "@vakyam-ai/tts";

const client = new VakyamAI({ apiKey: process.env.VAKYAM_API_KEY! });
```



#### cURL

```bash
curl https://api.vakyam.ai/v1/voices \
  -H "Authorization: Bearer $VAKYAM_API_KEY"
```

## Failed authentication

A missing, malformed, or revoked key returns `401 Unauthorized`:

```json
{
  "error": {
    "status_code": 401,
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked."
  }
}
```

## WebSocket authentication

The realtime WebSocket endpoint authenticates the same way — pass the
`Authorization` header on connect. A bad key closes the connection with code
`4001`. See the [realtime guide](/guides/realtime-websocket) for details.

---

*Powered by [holocron.so](https://holocron.so)*
