Skip to main content
POST
Add an AI key

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-ankra-organisation-id
string | null

Body

application/json
provider
enum<string>
required
Available options:
anthropic,
openrouter
api_key
string
required
write-only

An Anthropic API key (sk-ant-) or an OpenRouter API key (sk-or-). Surrounding spaces are trimmed.

label
string
default:""
Maximum string length: 100

Response

The stored key

One AI provider key on your profile. The key itself is never returned.

id
string<uuid>
required
provider
enum<string>
required
Available options:
anthropic,
openrouter
label
string
required

Your name for the key; empty when you gave none.

Maximum string length: 100
key_preview
string
required

The key's provider prefix and last four characters, such as sk-ant-...1234.

position
integer
required

Where the key sits in the order your work tries keys, starting at 0.

Required range: x >= 0
status
enum<string>
required

active keys are used. out_of_credit keys ran out of balance and are tried again after retry_after. rejected keys were refused by their provider and stay unused until a test passes.

Available options:
active,
out_of_credit,
rejected
retry_after
string<date-time> | null
required

When an out_of_credit key is next tried; null otherwise.

last_used_at
string<date-time> | null
required

When the key last served a request, to the minute; null if never.

created_at
string<date-time>
required