POST/api_keys/{apiKeyID}/revoke

Revoke an API key

Revokes an API key identified by its ID. You can include revocation_reason to record why the key was revoked. The response contains the API key's updated revocation state.

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

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

Optional revocation details. No body fields are marked as required.

revocation_reasonstringoptional
A reason to record for revoking the API key.

3 status codes
200Returns the updated API key object, including its revocation state and any revocation reason.
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.