# API keys API

Manage API keys from code instead of the dashboard's Connect tab. Requires a [dashboard token or another API key](/docs/authentication).

## Create a key

```
POST /api-keys
```

```json
{ "name": "prod-backend" }
```

Response `201` — **the only time the raw key is ever returned**:

```json
{
  "id": "...",
  "name": "prod-backend",
  "key_prefix": "wak_a1b2",
  "key": "wak_a1b2c3d4...",
  "created_at": "2026-08-17T12:00:00Z"
}
```

Store `key` immediately. It cannot be retrieved again — losing it means generating a new one.

## List keys

```
GET /api-keys
```

Returns `id`, `name`, `key_prefix`, `last_used_at`, `created_at` for each key — never the raw key. Use `key_prefix` and `last_used_at` to identify which key is which and spot unused ones.

## Revoke a key

```
DELETE /api-keys/{key_id}
```

`204`. Takes effect immediately — any request already using that key gets `401` on its next call.
