API Keys endpoint
Provision, list and revoke inference API keys programmatically.
The Platform API lets you manage inference keys from code — useful if you provision a key per customer, per environment, or per deployment rather than clicking through Studio.
These are Platform API endpoints. They authenticate differently from the inference endpoints: an OAuth JWT plus an X-Organization-Id header, not an elyxir_ key. The keys they manage are the elyxir_ keys you then use against /v1/chat/completions.
Authentication
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <oauth-jwt> |
X-Organization-Id | Yes | Your organization UUID |
Content-Type | For POST | application/json |
The organization UUID comes from the OAuth userinfo endpoint.
List keys
GET https://api.elyxir.ai/api/v1/api-keys
Returns metadata only. Key values are never returned after creation.
curl https://api.elyxir.ai/api/v1/api-keys \
-H "Authorization: Bearer <oauth-jwt>" \
-H "X-Organization-Id: 00000000-0000-0000-0000-000000000000"{
"keys": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "My App Production",
"keyPrefix": "a1b2c3d4e5f6",
"createdAt": "2026-08-01T10:00:00.000Z",
"lastUsedAt": "2026-08-03T09:12:00.000Z",
"totalRequests": 1542
}
]
}keyPrefix is the first 12 characters, enough to identify which key a log line refers to without exposing the credential.
Create a key
POST https://api.elyxir.ai/api/v1/api-keys
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name, minimum 3 characters |
curl -X POST https://api.elyxir.ai/api/v1/api-keys \
-H "Authorization: Bearer <oauth-jwt>" \
-H "X-Organization-Id: 00000000-0000-0000-0000-000000000000" \
-H "Content-Type: application/json" \
-d '{"name": "My App Production"}'Returns 201:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "My App Production",
"key": "elyxir_0123456789abcdef...",
"keyPrefix": "a1b2c3d4e5f6",
"createdAt": "2026-08-03T10:00:00.000Z"
}key is returned once, here. It cannot be retrieved again. Store it before you discard the response — if you lose it, revoke the key and create another.
Revoke a key
DELETE https://api.elyxir.ai/api/v1/api-keys/{keyId}
curl -X DELETE https://api.elyxir.ai/api/v1/api-keys/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer <oauth-jwt>" \
-H "X-Organization-Id: 00000000-0000-0000-0000-000000000000"{ "success": true, "id": "a1b2c3d4-...", "name": "My App Production" }Revocation is immediate and permanent. Any request using that key fails with 401 from the next call onward — rotate before you revoke, not after.
Errors
| Status | Applies to | Meaning |
|---|---|---|
| 400 | All | Missing X-Organization-Id, or an invalid name |
| 401 | All | Invalid or expired JWT |
| 402 | Create | No API credits — purchase credits first |
| 403 | All | Not a member of this organization |
| 404 | Revoke | Key not found |
| 409 | Create | A key with this name already exists |
Rotating a key safely
- Create the replacement
- Deploy it
- Confirm traffic has moved — watch
lastUsedAton the old key - Revoke the old key
Related
- Authentication — using keys against the inference API
- Usage — spend and token counts
- Virtual keys — managing keys in Studio