Skip to main content
PATCH
Update an API key

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

API key ID

Body

application/json

Update an API key. At least one field is required. A present policy fully replaces the key's permissions; an absent one leaves them unchanged. policy: null is not accepted: removing a key's restriction means deleting the key.

name
string

New API key name

Required string length: 1 - 255
Example:

"new-api-name"

policy
object

Permissions that fully replace the key's policy. Attaching a policy to a key without one makes the key scoped: every action and resource the policy does not list is denied. The key's credential, name, project, and expiry are unchanged, so consumers never need the key redistributed. A source_ip condition adds or changes IP allowlisting without rotating the credential. Requires api_keys:set_policy on the key.

Response

API key updated

created_at
string<date-time>
required

When the API key was created

created_by
object | null
required

Human audit creator, or null after creator deletion. Not the service credential's principal.

deleted_at
string<date-time> | null
required

When the API key was deleted (soft-deleted). Null for keys that have not been deleted.

expires_at
string<date-time> | null
required

When the API key expires

id
string
required

Unique API key identifier

Example:

"ckv9w8q2f000001l5r3j7k9m4"

last_used_at
string<date-time> | null
required

When the API key last authenticated a request, accurate to within about 20 minutes. Null if the key has not been used since last-use tracking began.

masked_key
string
required

Masked version of the API key

Example:

"sk_1234...abcd"

name
string
required

Label for the API key. API keys are not addressable by name; use the ID or key identifier for stable references.

Example:

"production"

project_id
string | null
required

Project identifier for project-scoped API keys. Null means org-wide.

Example:

"proj_abc123"

project_name
string | null
required

Project name for project-scoped API keys. Null means the key is org-wide or the project name is unavailable.

Example:

"Production"

policy
object | null

Permissions granted to a scoped API key. Absent for an ordinary key, which keeps unrestricted access within its organization or project.

principal
object
service_account_id
string

Organization-owned service principal, when linked.