Create API Key

POST /api/v1/gateway/keys

Creates a new sk-nex- API key. The full key is returned only once, in this response — store it immediately.

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 body

Field Type Required Description
name string yes Key name
team_id string | null no Bind to a team
models_allowed array<string> no Allowed model list (default = unrestricted)
rpm_limit integer no Requests-per-minute limit
tpm_limit integer no Tokens-per-minute limit
is_sandbox boolean no Whether this is a sandbox key
allowed_ips array | null no IP allowlist (null = unrestricted)
spending_limit_usd number | string | null no Total spending cap in USD, null = unlimited
expires_at string | null no Expiry time (ISO 8601)

Example

curl -X POST https://portal.aiin1.ai/api/v1/gateway/keys \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "prod-backend", "rpm_limit": 300, "spending_limit_usd": 500 }'

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