API keys
Most people never call these routes: Developer settings in the app uses them for you. They are listed so you know what the page does.
| Method | Path | Auth | What |
|---|---|---|---|
| POST | /api/v1/api-keys | Session | Create a key |
| GET | /api/v1/api-keys | Session | List keys (no secrets) |
| DELETE | /api/v1/api-keys/{id} | Session | Revoke a key |
/api/v1/api-keysCreate a key. The full key is in this response only. At most 10 active keys per account; the 11th returns 400. Session only: this route reads the signed-in browser cookie on www.brainpercent.app. A Bearer key is refused with 401.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | 1 to 100 characters |
| permissions | string[] | Optional | Any of read, write, delete, or render. A picture key holds render only (the key form calls it Pictures only): it can ONLY make pictures through the /renders routes, reads nothing else and gets 403 on every other endpoint. Default ["read"]. |
| scopes | string[] | Optional | Any of articles, social, projects, user. Only projects is enforced today. Default all four. |
| expires_in_days | integer | Optional | 1 to 365. Omit for a key that does not expire. |
// Run on https://www.brainpercent.app while signed in.
const res = await fetch('/api/v1/api-keys', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'My server', permissions: ['read', 'write'] }),
});
const { data } = await res.json();
console.log(data.key); // shown once{
"success": true,
"data": {
"id": "12084af0-825d-488e-86d8-343a80fc590a",
"name": "My server",
"key": "bp_eafc3cf0c78…(64 hex characters)",
"key_prefix": "bp_eafc3cf0c78...",
"permissions": [
"read",
"write"
],
"scopes": [
"articles",
"social",
"projects",
"user"
],
"created_at": "2026-10-29T15:34:48.441663+00:00",
"expires_at": null
}
}/api/v1/api-keysList every key on the account, newest first, including revoked ones (is_active false). Only the display prefix is returned, never the key. Session only: this route reads the signed-in browser cookie on www.brainpercent.app. A Bearer key is refused with 401.
const { data } = await fetch('/api/v1/api-keys').then((r) => r.json());
data.forEach((k) => console.log(k.name, k.key_prefix, k.is_active));{
"success": true,
"data": [
{
"id": "12084af0-825d-488e-86d8-343a80fc590a",
"name": "My server",
"key_prefix": "bp_eafc3cf0c78...",
"permissions": [
"read",
"write"
],
"scopes": [
"articles",
"social",
"projects",
"user"
],
"created_at": "2026-10-29T15:34:48.441663+00:00",
"last_used_at": "2026-10-29T15:46:25.102+00:00",
"expires_at": null,
"is_active": true
}
]
}/api/v1/api-keys/:idRevoke a key. It stops working on the next request, for REST and MCP alike. Revoking cannot be undone. An id that is not one of your keys returns 404; revoking an already revoked key returns 200 again. Session only: this route reads the signed-in browser cookie on www.brainpercent.app. A Bearer key is refused with 401.
await fetch('/api/v1/api-keys/12084af0-825d-488e-86d8-343a80fc590a', {
method: 'DELETE',
}).then((r) => r.json());{
"success": true,
"message": "API key revoked"
}Errors on these routes
| Status | Body | When |
|---|---|---|
| 400 | { "error": "Invalid JSON body" } | Body is not JSON |
| 400 | { "error": "Validation failed", "details": [...] } | Bad name, permission, scope or expiry |
| 400 | { "error": "Maximum 10 API keys allowed per user" } | Ten active keys already |
| 401 | { "error": "Authentication required" } | Not signed in (a Bearer key does not count) |
| 404 | { "error": "API key not found or already revoked" } | Revoke on an id that is not yours |