import requests
url = "https://api.platform.ankra.app/org/account/ai-keys"
payload = { "api_key": "<string>" }
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://api.platform.ankra.app/org/account/ai-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/account/ai-keys \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--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 (browser session)
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 signed-in browser session and the CSRF token; a profile holds at most 10 keys.
import requests
url = "https://api.platform.ankra.app/org/account/ai-keys"
payload = { "api_key": "<string>" }
headers = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://api.platform.ankra.app/org/account/ai-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.platform.ankra.app/org/account/ai-keys \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--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
Browser session. Mutations also require X-Ankra-CSRF.
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.