PATCH/api_keys/{apiKeyID}

Update an API key

Updates configurable properties of an API key. Include only the fields you want to change, such as scopes, description, subject, or seconds_until_expiration. The response contains the updated API key object.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 5 body fields
apiKeyIDstringrequired
The API key identifier, using the `ak_` or `api_key_` prefix followed by 32 hexadecimal characters.

API key properties to update. All body fields are optional.

claimsunknownoptional
Claims to associate with the API key; the schema does not specify a shape.
scopesarray<string>optional
The scopes to assign to the API key.
descriptionstringoptional
A description of the API key. Maximum 255 characters.
subjectstringoptional
The subject identifier for the API key. Must use the `user_`, `org_`, `mch_`, or `scim_` prefix followed by 27 word characters.
seconds_until_expirationnumberoptional
The API key lifetime in seconds. Must be greater than 0.

3 status codes
200Returns the updated API key object, including its current configuration and status.
objectstringrequired
Allowed:api_key
idstringrequired
typestringrequired
subjectstringrequired
namestringrequired
descriptionstringoptional
claimsunknownrequired
scopesarray<string>required
revokedbooleanrequired
revocation_reasonstringrequired
expiredbooleanrequired
expirationnumberrequired
The timestamp for when the API key will expire, in milliseconds
created_bystringrequired
last_used_atnumberrequired
The timestamp for when the API key was last used, in milliseconds
created_atnumberrequired
The timestamp for when the API key was created, in milliseconds
updated_atnumberrequired
The timestamp for when the API key was last updated, in milliseconds
400Returned when the request is invalid.
errorsarray<object>required
404Returned when the API key is not found.
errorsarray<object>required

Error handling

A 400 indicates invalid request data; a 404 indicates the API key was not found. The apiKeyID path parameter must match either the ak_ or api_key_ prefix followed by 32 hexadecimal characters. If provided, description must not exceed 255 characters and seconds_until_expiration must be greater than 0; subject must match the specified subject identifier format.