API reference

API reference · Keys

Change a key's name, scopes, expiry or address allowlist

PATCH/api/keys/{id}Signed in session

Scopes are enforced at verification and again in the policy layer, and a refusal names the scope that was missing. An address allowlist that cannot be checked is a refusal, never a pass.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredintegerThe key id.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
namestring
scopesarray of KeyScope
expiresAtinteger or nullUnix ms. Null clears the expiry.
ipAllowlistarray of string or nullAddresses or CIDR blocks, either family. Null clears it.

Example

{
  "name": "string",
  "scopes": [
    "chat"
  ],
  "expiresAt": 0,
  "ipAllowlist": [
    "string"
  ]
}

Answer 200

Changed.

Fields of the 200 answer
FieldTypeWhat it is
okboolean
scopesChangedboolean

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 404OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter