Skip to main content
Docs
API Keys endpoint

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.

Authentication

HeaderRequiredDescription
AuthorizationYesBearer <oauth-jwt>
X-Organization-IdYesYour organization UUID
Content-TypeFor POSTapplication/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
FieldTypeRequiredDescription
namestringYesDisplay 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"
}

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

StatusApplies toMeaning
400AllMissing X-Organization-Id, or an invalid name
401AllInvalid or expired JWT
402CreateNo API credits — purchase credits first
403AllNot a member of this organization
404RevokeKey not found
409CreateA key with this name already exists

Rotating a key safely

  1. Create the replacement
  2. Deploy it
  3. Confirm traffic has moved — watch lastUsedAt on the old key
  4. Revoke the old key
API Keys endpoint | Alvin