# `revoke()`

## [`RevokeAPIKeyParams`](/content/docs/reference/backend/api-keys/revoke#revoke-api-key-params/index.html)

- **Name** `apiKeyId`  
  **Type** `string`  
  **Description**  
  The ID of the API key to revoke.

- **Name** `revocationReason?`  
  **Type** `string | null`  
  **Description**  
  The reason for revoking the API key. Useful for your records.

## [Usage](/content/docs/reference/backend/api-keys/revoke#usage/index.html)

### [Revoke an API key](/content/docs/reference/backend/api-keys/revoke#revoke-an-api-key/index.html)

```javascript
const apiKeyId = 'apikey_123'

const response = await clerkClient.apiKeys.revoke({
  apiKeyId: apiKeyId,
})
```

### [Revoke an API key with a reason](/content/docs/reference/backend/api-keys/revoke#revoke-an-api-key-with-a-reason/index.html)

```javascript
const apiKeyId = 'apikey_123'

const response = await clerkClient.apiKeys.revoke({
  apiKeyId: apiKeyId,
  revocationReason: 'Key compromised',
})
```

## [Backend API (BAPI) endpoint](/content/docs/reference/backend/api-keys/revoke#backend-api-bapi-endpoint/index.html)

This method in the SDK is a wrapper around the BAPI endpoint `POST/api_keys/{apiKeyID}/revoke`. See the [BAPI reference](/content/docs/reference/backend-api/tag/api-keys/POST/api_keys/%7BapiKeyID%7D/revoke/index.html) for more information.

Revokes the given API key. This will immediately invalidate the API key and prevent it from being used to authenticate any future requests.

Returns the revoked [`APIKey`](/content/docs/reference/backend/types/backend-api-key/index.html) object.

```
function revoke(params: RevokeAPIKeyParams): Promise<APIKey>
```

Important: When you revoke an API key, it is immediately invalidated. Any requests using that API key will be rejected. Make sure to notify users or update your systems before revoking API keys that are in active use.
