> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/en/llms.txt
> - v0: https://docs.butterix.com/en/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/en/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# Ask AI session token

`GET /_biti/ai/token`

Gets the session token needed for [Ask AI chat](https://docs.butterix.com/en/api-reference/runtime/ask-ai.md). It's valid for 30 minutes and tied to the site, the client's network, and the browser (get a new one after switching network or browser).
Cross-site requests get 403; at most 30 per minute per IP.

Base URL: https://butterix-sites.butterix.com

## Example request

```bash
curl https://butterix-sites.butterix.com/_biti/ai/token
```

## Responses

### 200

Session token

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `token` | string | yes |  |
| `expiresAt` | integer | yes | Expiry time (millisecond timestamp) |

### 403

Cross-site request

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | yes | Human-readable error message |
| `code` | string | no | Machine-readable error code (some endpoints) |

### 429

Too many requests

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | yes | Human-readable error message |
| `code` | string | no | Machine-readable error code (some endpoints) |

### Example response (200)

```json
{
  "token": "1795435200000.Zm9vYmFyYmF6cXV4cXV1eGNvcmdl",
  "expiresAt": 1
}
```
