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
| Field | Type | What it is |
|---|---|---|
| id (path)required | integer | The key id. |
Request body
application/json, required
| Field | Type | What it is |
|---|---|---|
| name | string | |
| scopes | array of KeyScope | |
| expiresAt | integer or null | Unix ms. Null clears the expiry. |
| ipAllowlist | array of string or null | Addresses or CIDR blocks, either family. Null clears it. |
Example
{
"name": "string",
"scopes": [
"chat"
],
"expiresAt": 0,
"ipAllowlist": [
"string"
]
}Answer 200
Changed.
| Field | Type | What it is |
|---|---|---|
| ok | boolean | |
| scopesChanged | boolean |
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.