GRGlobalRouter Docs
Console

API keys / POST

Create API key

Creates a new tenant API key.

POST /api/v1/keys

The caller must use a key with the management scope. The new key is automatically owned by the calling key's owner. This endpoint cannot grant management; any active Portal user can configure their own active key, while a Workspace Owner can configure active keys owned by other tenant members.

Back to API keys endpoint list

Request parameters

FieldTypeRequiredDescription
namestringNoKey name for team identification.
scopesstring[]NoBusiness scopes, such as chat, models, or tasks; management is not allowed.
allowed_modelsstring[]NoList of allowed GlobalRouter model IDs.
blocked_modelsstring[]NoList of blocked model IDs.
allowed_ipsstring[]NoSource IP allowlist.
rate_limit_per_minuteintegerNoPer-minute rate limit.
expires_atstringNoExpiration time; ISO 8601 is recommended.

Request examples

Create API key request examples
curl "https://api.globalrouter.com/api/v1/keys" \
  -H "Authorization: Bearer $GR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-chat-key",
    "scopes": ["chat", "models"],
    "allowed_models": ["qwen3-32b"],
    "blocked_models": ["legacy-model"],
    "allowed_ips": ["203.0.113.10"],
    "rate_limit_per_minute": 120,
    "expires_at": "2026-12-31T23:59:59Z"
  }'

Response fields

FieldTypeRequiredDescription
data.idstringYesAPI key record ID.
data.api_keystringYesPlaintext value of the new key, returned only once in the creation response.
data.tenant_idstringYesTenant ID owning the key.
data.namestringYesKey name.
data.key_prefixstringYesKey prefix for identification and troubleshooting.
data.scopesstring[]YesScopes.
data.statusstringYesactive, disabled, or revoked.
data.allowed_modelsstring[]NoModel allowlist.
data.blocked_modelsstring[]NoModel blocklist.
data.allowed_ipsstring[]NoSource IP allowlist.
data.rate_limit_per_minuteintegerNoCurrent rate limit.
data.expires_atstringNoExpiration time.
data.last_used_atstringNoLast-used time.

Response example

Response example
{
  "data": {
    "id": "key_123",
    "api_key": "<shown-once>",
    "tenant_id": "tenant_123",
    "name": "production-chat-key",
    "key_prefix": "gr_live",
    "scopes": ["chat", "models"],
    "status": "active",
    "allowed_models": ["qwen3-32b"],
    "blocked_models": ["legacy-model"],
    "allowed_ips": ["203.0.113.10"],
    "rate_limit_per_minute": 120,
    "expires_at": "2026-12-31T23:59:59+00:00",
    "last_used_at": null
  }
}