GRGlobalRouter Docs
Console

API keys / PATCH

Update API key

Updates an API key's name, scopes, model ranges, source IPs, or rate limit.

PATCH /api/v1/keys/{key_ref}

Only fields present in the request body are updated, and the target must belong to the calling key's owner. Management cannot be added or removed; an existing management key must preserve it when updating scopes.

Back to API keys endpoint list

Request parameters

FieldTypeRequiredDescription
key_refpathYesKey ID, prefix, or supported key reference.
namestringNoNew key name.
scopesstring[]NoNew scopes; the presence of management cannot be changed.
statusstringNoKey status, such as active or disabled.
rate_limit_per_minuteintegerNoNew per-minute rate limit.
allowed_modelsstring[]NoNew model allowlist.
blocked_modelsstring[]NoNew model blocklist.
allowed_ipsstring[]NoNew source IP allowlist.
expires_atstringNoNew expiration time; send null to clear it.

Request examples

Update API key request examples
curl -X PATCH "https://api.globalrouter.com/api/v1/keys/key_123" \
  -H "Authorization: Bearer $GR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-chat-key-v2",
    "status": "active",
    "allowed_ips": ["203.0.113.10"],
    "expires_at": "2026-12-31T23:59:59Z",
    "rate_limit_per_minute": 240
  }'

Response fields

FieldTypeRequiredDescription
data.idstringYesAPI key record ID.
data.tenant_idstringYesTenant ID owning the key.
data.namestringYesUpdated key name.
data.key_prefixstringYesKey prefix for identification and troubleshooting.
data.scopesstring[]YesUpdated scopes.
data.statusstringYesUpdated key status.
data.allowed_modelsstring[]NoUpdated model allowlist.
data.blocked_modelsstring[]NoUpdated model blocklist.
data.allowed_ipsstring[]NoUpdated source IP allowlist.
data.rate_limit_per_minuteintegerNoUpdated rate limit.
data.expires_atstringNoUpdated expiration time.
data.last_used_atstringNoLast-used time.

Response example

Response example
{
  "data": {
    "id": "key_123",
    "tenant_id": "tenant_123",
    "name": "production-chat-key-v2",
    "key_prefix": "gr_live",
    "scopes": ["chat", "models"],
    "status": "active",
    "allowed_models": ["qwen3-32b"],
    "blocked_models": [],
    "allowed_ips": ["203.0.113.10"],
    "rate_limit_per_minute": 240,
    "expires_at": "2026-12-31T23:59:59+00:00",
    "last_used_at": "2026-06-26T10:05:00+00:00"
  }
}