Skip to main content
POST
/
user
/
api-keys
Create a personal API key
curl --request POST \
  --url https://{organization_id}.platform.barndoor.ai/api/llm-gateway/user/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "expires_at": "2023-11-07T05:31:56Z"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "key_prefix": "<string>",
  "key": "bd-abcd1234ef56...",
  "scopes": [
    "<string>"
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "group_name": "<string>",
  "expires_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT obtained through Barndoor's authentication flow. Pass the token verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's loginInteractive() helper to obtain a token in scripts and notebooks.

Body

application/json
name
string
required
expires_at
string<date-time> | null

Response

200 - application/json

The newly created key

id
string<uuid>
required
name
string
required
key_prefix
string
required
key
string
required

The raw API key. Returned only at creation time and never stored in plaintext — copy it immediately. Use this value as Authorization: Bearer <key> (or x-api-key: <key>) on requests to /v1/chat/completions, /v1/messages, and friends.

Example:

"bd-abcd1234ef56..."

scopes
string[]
required
created_at
string<date-time>
required
group_name
string | null
expires_at
string<date-time> | null