---
type: api
title: Delete API keys for a user
description: Delete or invalidate all of the API keys for a user.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-user-api-keys
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-user-api-keys
products:
  - Elastic Cloud Enterprise
---

# Delete API keys for a user

## Paths

- `DELETE` `/users/{user_id}/auth/keys`

- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#basicauth)
- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#apikey)

#### Path Parameters

- `user_id` (string)
  The user ID.

## Description

Delete or invalidate all of the API keys for a user.

## Responses

#### `200`

The API key is deleted.

`application/json`

Type: `EmptyResponse`

#### `404`

The {user_id} can't be found. (code: `api_keys.user_not_found`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code Examples

#### Console

```console
DELETE /users/{user_id}/auth/keys
```

#### curl

```curl
curl -X DELETE "/users/{user_id}/auth/keys"
```

