import requests
url = "https://platform.ankra.app/api/v1/org/account/ai-keys"
payload = { "api_key": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/account/ai-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/account/ai-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "anthropic",
"label": "<string>",
"key_preview": "<string>",
"position": 1,
"status": "active",
"retry_after": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Add an AI key
Checks the key with its provider, stores it in Vault and adds it to the end of your order. Claude subscription tokens and Anthropic admin keys are refused before anything is sent to Anthropic. Requires your own personal access token: a service account’s token and an MCP-scoped token are refused, and so is a token whose scopes allow no changes. A profile holds at most 10 keys.
import requests
url = "https://platform.ankra.app/api/v1/org/account/ai-keys"
payload = { "api_key": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/account/ai-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/account/ai-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "anthropic",
"label": "<string>",
"key_preview": "<string>",
"position": 1,
"status": "active",
"retry_after": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
Response
The stored key
One AI provider key on your profile. The key itself is never returned.
anthropic, openrouter Your name for the key; empty when you gave none.
100The key's provider prefix and last four characters, such as sk-ant-...1234.
Where the key sits in the order your work tries keys, starting at 0.
x >= 0active 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.
active, out_of_credit, rejected When an out_of_credit key is next tried; null otherwise.
When the key last served a request, to the minute; null if never.