For the complete documentation index, see llms.txt. This page is also available as Markdown.

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}

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.

post
Body
namestringOptional

Optional human-readable name of the API key.

Example: 20260202-key-for-llms
Responses
200

API key creation result

application/json
post/v1/keys
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"
    ]
  }'
200

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.

get
Responses
200

List of API keys, ordered from oldest to newest

application/json
get/v1/keys
curl -L \
  --request GET \
  --url 'https://api.aimlapi.com/v1/keys' \
  --header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>'
200

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.

get
Responses
200

Parameters of the latest API key

application/json
get/v1/key
curl -L \
  --request GET \
  --url 'https://api.aimlapi.com/v1/key' \
  --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'
200

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

patch
Path parameters
prefixstringRequired

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).

Example: b747e891
Body
namestringOptional

Optional human-readable name of the API key.

Example: 20260202-key-for-llms
disabledbooleanOptional

Enable or disable the API key.

Example: false
Responses
200

Updated API key parameters

application/json
patch/v1/keys/{prefix}
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
  }'
200

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

delete
Path parameters
prefixstringRequired

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).

Example: b747e891
Responses
200

Key deletion result

application/json
delete/v1/keys/{prefix}
curl -L \
  --request DELETE \
  --url 'https://api.aimlapi.com/v1/keys/<API_KEY_PREFIX>' \
  --header 'Authorization: Bearer <YOUR_MANAGEMENT_KEY>'
200

Key deletion result

{
  "data": {
    "prefix": "b747e891",
    "deleted": true
  }
}

Last updated

Was this helpful?