revoke()
Revokes an API key by its ID. This will immediately invalidate the API key and prevent it from being used to authenticate any future requests. Returns an APIKeyResource object.
function revoke(params: RevokeAPIKeyParams): Promise<APIKeyResource>- Name
apiKeyId- Type
string- Description
The ID of the API key to revoke.
- Name
revocationReason?- Type
string | null- Description
Optional reason for revocation. Useful for your records.
const apiKeyId = 'apikey_123'
const response = await clerkClient.apiKeys.revoke({
apiKeyId: apiKeyId,
})const apiKeyId = 'apikey_123'
const response = await clerkClient.apiKeys.revoke({
apiKeyId: apiKeyId,
revocationReason: 'Key compromised',
})Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint POST/api_keys/{apiKeyID}/revoke. See the BAPI reference for more information.
Feedback
Last updated on