API keys

Update an API key

Updates mutable fields of an API key: display name, status (active / disabled / revoked), permission mode and access map, project scope, and constraints (budget / rate limit / expiry). Omitted fields keep their current values.

patch/v2/api-keys/{api_key_id}

Path parameters

api_key_idstring required

API key id to update.

Request body

namestring

New name. Omit to keep current.

status'API_KEY_STATUS_UNSPECIFIED' | 'API_KEY_STATUS_ACTIVE' | 'API_KEY_STATUS_DISABLED' | 'API_KEY_STATUS_REVOKED'
permission_mode'PERMISSION_MODE_UNSPECIFIED' | 'PERMISSION_MODE_ALL' | 'PERMISSION_MODE_RESTRICTED' | 'PERMISSION_MODE_READ_ONLY'
accessobject

Replacement access map. Required when changing to PERMISSION_MODE_RESTRICTED; ignored otherwise. Provide an empty map to clear. See ApiKey.access for the full catalog of valid keys (Domain.id) and AccessLevel string values, or fetch the live catalog via the capability catalog endpoint.

expires_atstring date-time

New expiration. Omit to keep current. Set clear_expires_at = true to remove an existing expiration (a zero Timestamp here would still mean "no change" because of optional semantics).

clear_expires_atboolean

Force-clear the expiration. Mutually exclusive with expires_at.

Response

OK

Changes