API reference
API keys
Create, list, change and revoke API keys from code, with the limits each key carries.
Requires a signed-in session; see Account API. For what each limit does on a request, see API keys.
POST /keys
Creates a key.
{
"project_id": "<uuid>",
"name": "checkout-summariser-prod",
"expires_at": "2026-12-31T23:59:00+05:00",
"credit_limit_cents": 5000000000,
"allowed_models": ["paranine/gpt-oss-120b(Global)"],
"rate_limit_rpm": 120,
"environment": "production"
}| Field | Rules |
|---|---|
project_id | Required. A project from GET /projects. |
name | Required. 1 to 100 characters. Must differ from every active key's name in the project, ignoring case and surrounding spaces; a name in use answers 409 (key_name_taken). Revoking a key frees its name. |
expires_at | Optional. ISO 8601 with a UTC offset, in the future. |
credit_limit_cents | Optional. A lifetime spending cap for this key, in millionths of a rupee (Rs 5,000 is 5000000000). |
allowed_models | Optional. Model ids this key may call; an unknown id answers 400 naming it. Can't be changed later. |
rate_limit_rpm | Optional. Requests per minute, from 1 up to the platform maximum. Default 60. |
use_platform_max_rate_limit | Optional. true gives the key the platform maximum, whatever rate_limit_rpm says. |
environment | Optional. production (default), development or testing. A label for your own filtering. |
Response:
{
"id": "<uuid>",
"name": "checkout-summariser-prod",
"project_id": "<uuid>",
"key_prefix": "sk_p9_XXXXXX",
"rate_limit_rpm": 120,
"expires_at": "2026-12-31T23:59:00+05:00",
"credit_limit_cents": 5000000000,
"allowed_models": ["paranine/gpt-oss-120b(Global)"],
"environment": "production",
"enforcement_status": {
"expires_at": "enforced",
"credit_limit_cents": "enforced",
"allowed_models": "enforced"
},
"api_key": "sk_p9_<32 characters>"
}Important
api_keyis the key itself, and this response is the only time you'll see it. Store it before doing anything else.
GET /keys
Lists your organisation's active keys, newest first. Add ?include_revoked=true to include revoked keys.
{
"keys": [
{
"id": "<uuid>",
"name": "checkout-summariser-prod",
"key_prefix": "sk_p9_XXXXXX",
"project_id": "<uuid>",
"created_at": "2026-08-04T15:38:49.451247+05:00",
"last_used_at": null,
"rate_limit_rpm": 60,
"expires_at": null,
"credit_limit_cents": null,
"allowed_models": null,
"environment": "production",
"revoked": false
}
]
}Keys are never returned, only their prefix. last_used_at is null for a key that hasn't made a request in the last 12 months.
PATCH /keys/{key_id}
Changes a key's rate limit, credit cap and expiry. Its name, project, allowed models and environment can't be changed: create a new key instead.
{
"rate_limit_rpm": 1000,
"credit_limit_pkr": 500,
"expires_at": 1790333428
}Send all three every time. The call replaces the key's limits with exactly what you send. Note that two units differ from POST /keys:
| Field | Rules |
|---|---|
rate_limit_rpm | Required. Up to the platform maximum. |
credit_limit_pkr | In rupees, not millionths. Omitted, null or 0 means no cap. |
expires_at | Unix seconds, not ISO 8601. Omitted, null or 0 means no expiry; otherwise it must be in the future. |
A cap can't be set below what the key has already spent. When you raise a cap, the caps of all your keys together can't exceed your organisation's budget; lowering a cap is always allowed. Either refusal is a 400 whose message gives the figure.
Response:
{
"id": "<uuid>",
"key_prefix": "sk_p9_XXXXXX",
"rate_limit_rpm": 1000,
"expires_at": "2026-09-25T15:50:28+05:00",
"credit_limit_cents": 500000000
}If the call answers 503, nothing was changed: retry after Retry-After.
DELETE /keys/{key_id}
Revokes the key. It stops working within seconds. Returns {"message": "API key revoked"}, or 404 for a key that doesn't exist, isn't yours, or is already revoked.
Something unclear or wrong on this page? Tell us. Machine-readable copies: llms.txt.