V1 / Tokens / Api-keys / Index

Create an API key

Create a space-scoped API key. The plain token is returned once, on creation. Session-authenticated (dashboard login; owner/admin).

POST/api/v1/tokens/api-keys/index

Request body

PropertyTypeRequiredDescription
namestringYesKey name (max 200 chars)
expiresAtstringNoISO datetime expiry
neverExpiresbooleanNoNo expiry. Default: false
shortTokenbooleanNoShorter ~96-bit token instead of ~256-bit. Default: false
scopesobjectNoOptional restrictions: { mcpTools?: string[], apiEndpoints?: string[] }. Omit a list to allow all; [] denies all.

Responses

200

JSON { doc } including the plain token (shown only once)

401

Not logged in

Request
curl -X POST "https://bannx.com/api/v1/tokens/api-keys/index" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{"name":"string","expiresAt":"string","neverExpires":false,"shortToken":false,"scopes":null}'
Response
// JSON { doc } including the plain token (shown only once)
{
  "success": true,
  "data": { ... }
}