# API Keys API

> List, create and revoke the API keys used for the REST API and the XBeast MCP server.

Source: https://xbeast.io/docs/api-keys

Manage the same `xb_live_` keys used by the REST API and the XBeast MCP server. A key's access mode decides whether it can only read or can also write and generate.

> **Only a full-access key can manage keys**
>
> This prevents a read-only key from creating a full-access key. The plaintext secret is returned once, on creation, and never again.

## API key object

```json
{
  "id": "key_123",
  "name": "Claude Code",
  "key_prefix": "xb_live_ab12",
  "access_mode": "full",
  "last_used_at": "2026-11-28T09:00:00.000Z",
  "created_at": "2026-11-20T14:00:00.000Z",
  "revoked_at": null
}
```

### List active keys

**`GET /api/v1/api-keys`**

Returns `{ data: [ ...ApiKey ] }` with active keys only. The secret and its hash are never included.

### Create a key

**`POST /api/v1/api-keys`**

#### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| name | string | No | Label, e.g. Claude Code. Default “Default”. |
| access_mode | string | No | full (default) or read_only. |

```bash
curl -X POST "https://xbeast.io/api/v1/api-keys" \
  -H "Authorization: Bearer xb_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Claude Code", "access_mode": "read_only" }'
```

Response: `{ data: { api_key, key, warning } }`. `data.key` is the only time the secret is shown. Maximum 5 active keys per user.

### Revoke a key

**`DELETE /api/v1/api-keys/:id`**

Revocation is immediate: integrations using the key start receiving `401`.

## Access modes

| Mode | Can read | Can write/generate |
| --- | --- | --- |
| full | Yes | Yes |
| read_only | Yes | No — 403 read_only_key |

## Related

- [Authentication and header rules](https://xbeast.io/docs/api-authentication.md)
- [Connect a key to your MCP client](https://xbeast.io/docs/mcp.md)
- [Create and revoke keys in the app](https://xbeast.io/developers)
