api-keys

Create a new API key for the authenticated user.

Only JWT-authenticated (browser session) requests are permitted — API key creation via an existing API key is blocked to prevent credential chaining.

Nothing here waits on Stripe — see :func:_schedule_stripe_customer_backfill.

Args: request: The incoming FastAPI request (used by SlowAPI rate limiter). body: The API key creation request payload. auth: The authenticated user context.

Returns: CreateAPIKeyResponse with the secret key (shown only once).

Raises: HTTPException: 403 if called via API key or the active team's key cap is zero, 409 if the cap is already reached or the name is taken, 500 for unexpected failures.

post/v1/create-api-key

Request

Request body

namestring required

Name for the API key

expires_atstring nullable

Optional expiration timestamp (ISO 8601). Sentinel strings like 'never' are accepted and treated as no expiration.

team_idstring nullable

Team to bind the key to. Defaults to the caller's active team when omitted; an explicit value must equal the active team.

captcha_tokenstring nullable

hCaptcha response token for bot verification

Response

Successful Response

idstring required
namestring required
api_key_last_digitsstring required
created_atstring required
expires_atstring nullable
team_idstring required
secret_keystring required
stripe_customer_createdboolean

Changes