Skip to main content
PATCH
Update API Key

Overview

Updates an API key. The raw key value is never affected; use Rotate API Key to issue new credentials. Metadata uses merge semantics (null values remove keys). Scope changes are subject to escalation prevention: you cannot grant scopes that the calling key does not already hold. System keys cannot be modified, and revoked or expired keys return 404. Requires the api-keys:manage scope and an Idempotency-Key header; see Idempotency.

Path Parameters

id
string
required
API key ID (key_...).

Request Body

name
string
New name (1-255 characters).
scopes
string[]
Replacement scope list (at least one). Subject to escalation prevention.
expires_at
string
New expiry as an ISO 8601 timestamp, or null to clear. Must be in the future.
metadata
object
Metadata patch. Values may be strings or null.

Response

Returns the updated API key, with the same fields as Get API Key.

Code Examples

Errors