Update API Key

PUT /api/v1/gateway/keys/{key_id}

Updates a key's name, model allowlist, rate limits, or spending cap. Send only the fields you want to change. Requires an admin-or-above role (admin / ops / super).

Auth: this endpoint belongs to the console backend API (base URL https://portal.aiin1.ai — note, not api.portal.aiin1.ai). It requires an access_token obtained by logging in with a console account (valid 15 minutes); the sk-nex- API token does not work here. See Billing Reconciliation & Automated Usage Sync for the login flow.

Request parameters

Param In Type Required Description
key_id path string(uuid) yes Key ID

Request body

Field Type Required Description
name string | null no Key name
models_allowed array | null no Allowed model list
allowed_ips array | null no IP allowlist
rpm_limit integer | null no Requests-per-minute limit
tpm_limit integer | null no Tokens-per-minute limit
spending_limit_usd number | string | null no Total spending cap (USD)

Example

curl -X PUT https://portal.aiin1.ai/api/v1/gateway/keys/KEY_ID \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "rpm_limit": 600 }'

Response

Field Type Required Description
id string(uuid) yes Key ID
org_id string(uuid) yes Organization ID
team_id string | null no Owning team ID
name string yes Key name
key string | null no Full key, returned only once at creation / rotation
key_prefix string yes Key prefix (for display)
models_allowed array<string> yes Allowed model list (empty = unrestricted)
rpm_limit integer yes Requests-per-minute limit
tpm_limit integer yes Tokens-per-minute limit
is_sandbox boolean yes Whether this is a sandbox key
allowed_ips array | null no IP allowlist (null = unrestricted)
spending_limit_usd string | null no Total spending cap (USD), null = unlimited
expires_at string | null no Expiry time
rotate_grace_until string | null no Grace-period end for the old key after rotation
status string yes Status
created_at string(datetime) yes Created at