# Authentication

API key authentication for the AVCodex API.

---

> **Note:** API access requires a Builder plan or higher. Free accounts cannot access the API. [Upgrade to Builder](https://app.avcodex.com/plans)

## Getting your API key

1. Log into [app.avcodex.com](https://app.avcodex.com).
2. Navigate to your agent.
3. Click **Share** in the sidebar.
4. Find the "Share via API" section.
5. Click the eye icon to reveal your API key.
6. Copy your API key.

> **Tip:** The Share tab includes a ready-to-use curl example with your agent's model name. Click the copy button to get a working request with your API key included.

## Using your API key

Include your API key in the Authorization header:

```bash
Authorization: Bearer YOUR_API_KEY
```

### Example

```bash
curl https://app.avcodex.com/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "myagent-123",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

## Required headers

| Header           | Value                  |
|------------------|------------------------|
| `Authorization`  | `Bearer YOUR_API_KEY`  |
| `Content-Type`   | `application/json`     |

## Error responses

### Authentication errors (401)

```json
{
  "error": "Missing API key"
}
```
No Authorization header provided.

```json
{
  "error": "Invalid API key"
}
```
The API key is incorrect or does not match the agent.

```json
{
  "error": "This API is only available on a paid plan.  Visit your dashboard to upgrade."
}
```
Free accounts cannot access the API. Requires Builder plan or higher.

*AVCodex · Your AV expertise. Amplified by AI.*