> ## Documentation Index
> Fetch the complete documentation index at: https://docs.a21e.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Overview

> Base URL, authentication, rate limits, and response format for the a21e API.

## Base URL

```
https://api.a21e.com
```

All API endpoints are versioned under `/v1/`.

## Authentication

Include your API key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer a21e_sk_your_api_key_here
```

Get an API key from [Settings > API Keys](https://a21e.com/api-key).

## Request format

All request bodies use JSON:

```bash theme={null}
curl -X POST https://api.a21e.com/v1/rpc \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"method": "intent.submit", "params": {"input": "Hello"}}'
```

## Response format

Responses are JSON with standard HTTP status codes:

| Status | Meaning                                   |
| ------ | ----------------------------------------- |
| `200`  | Success                                   |
| `201`  | Created                                   |
| `400`  | Bad request (invalid parameters)          |
| `401`  | Unauthorized (missing or invalid API key) |
| `402`  | Insufficient credits                      |
| `404`  | Resource not found                        |
| `429`  | Rate limited                              |
| `500`  | Internal server error                     |

Error responses include a message:

```json theme={null}
{
  "error": "INSUFFICIENT_CREDITS",
  "message": "Your credit balance is 0."
}
```

## Rate limits

| Endpoint          | Limit               |
| ----------------- | ------------------- |
| Intent submission | 60 requests/minute  |
| Chat completions  | 60 requests/minute  |
| Read endpoints    | 120 requests/minute |

Rate-limited responses return `429` with a `Retry-After` header.

## Endpoints

The API has two main entry points:

1. **JSON-RPC** (`POST /v1/rpc`) — the canonical endpoint for intent submission
2. **REST endpoints** — resource-specific endpoints for CRUD operations (sessions, messages, memory, etc.)
3. **OpenAI-compatible** (`POST /v1/chat/completions`) — drop-in replacement for OpenAI SDK

Explore the full API in the sidebar, or try endpoints in the interactive playground.
