API Key Management
POST https://api.aimlapi.com/v1/keys
GET https://api.aimlapi.com/v1/keys
GET https://api.aimlapi.com/v1/key
PATCH https://api.aimlapi.com/v1/keys/{prefix}
DELETE https://api.aimlapi.com/v1/keys/{prefix}
Before you start you should create a management key.
Create a new API key
Copy the created key and store it in a secure location. If the key is lost, create a new one.
Optional human-readable name of the API key.
20260202-key-for-llmsAPI key creation result
curl -L \
--request POST \
--url 'https://api.aimlapi.com/v1/keys' \
--header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "20260202-key-for-llms",
"limit": {
"retention": "week",
"threshold": 25
},
"scopes": [
"model:chat",
"model:responses"
]
}'API key creation result
{
"data": {
"name": "20260202-key-for-llms",
"disabled": false,
"prefix": "b747e891",
"scopes": [
"model:chat"
],
"limit": {
"retention": "no_reset",
"threshold": 25
},
"created_at": "2026-02-18T06:59:10.031Z",
"updated_at": "2026-02-18T06:59:10.031Z",
"monthly_usage": 0,
"key": "b747e891847f4c3fa0f6cce1cfd79bf9"
}
}List API keys
Returns all API keys for your account, including each key’s settings and metadata.
List of API keys, ordered from oldest to newest
curl -L \
--request GET \
--url 'https://api.aimlapi.com/v1/keys' \
--header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>'List of API keys, ordered from oldest to newest
{
"data": [
{
"name": "20260202-key-for-llms",
"prefix": "b747e891",
"disabled": false,
"scopes": [
"model:chat"
],
"limit": {
"retention": "no_reset",
"threshold": 25
},
"created_at": "2026-02-18T06:59:10.031Z",
"updated_at": "2026-02-18T06:59:10.031Z",
"monthly_usage": 0
}
]
}Get the API key
Retrieve parameters of the most recently used API key.
Parameters of the latest API key
curl -L \
--request GET \
--url 'https://api.aimlapi.com/v1/key' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'Parameters of the latest API key
{
"data": {
"name": "20260202-key-for-llms",
"disabled": false,
"prefix": "b747e891",
"scopes": [
"model:chat"
],
"limit": {
"retention": "no_reset",
"threshold": 25
},
"created_at": "2026-02-18T06:57:29.232Z",
"updated_at": "2026-02-18T06:57:29.232Z",
"monthly_usage": 0
}
}Update an API key
Prefix of the API key to update. Passed in the URL path. This is the first 8 characters of your API key, visible in the dashboard. You can also obtain this value via the GET method (see the prefix field in its response).
b747e891Optional human-readable name of the API key.
20260202-key-for-llmsEnable or disable the API key.
falseUpdated API key parameters
curl -L \
--request PATCH \
--url 'https://api.aimlapi.com/v1/keys/<API_KEY_PREFIX>' \
--header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"disabled": false
}'Updated API key parameters
{
"data": {
"name": "20260202-key-for-llms",
"disabled": false,
"prefix": "b747e891",
"scopes": [
"model:chat"
],
"limit": {
"retention": "no_reset",
"threshold": 25
},
"created_at": "2026-02-18T06:59:10.031Z",
"updated_at": "2026-02-18T06:59:10.031Z",
"monthly_usage": 0
}
}Delete an API key
Prefix of the API key to delete. Passed in the URL path. This is the first 8 characters of the API key you want to delete. Passed in the URL path. This is the first 8 characters of your API key, visible in the dashboard. You can also obtain this value via the GET method (see the prefix field in its response).
b747e891Key deletion result
curl -L \
--request DELETE \
--url 'https://api.aimlapi.com/v1/keys/<API_KEY_PREFIX>' \
--header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>'Key deletion result
{
"data": {
"prefix": "b747e891",
"deleted": true
}
}Last updated
Was this helpful?