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

# Delete API keys of multiple users

Authentication: required

## Paths

- `DELETE` `/users/auth/keys/_all`

## Description

Delete or invalidate the API keys for multiple users.

## Request body

The request to delete API keys.

`application/json`

- `user_api_keys` (object[]) — required
  The list of API key IDs.
  - `user_id` (string) — required
    The user ID.
  - `api_key_id` (string) — required
    The API key ID.

## Responses

#### `200`

The API keys are deleted.

`application/json`

Type: `object`

#### `401`

The request is missing authentication or the supplied authentication is invalid. (code: `root.unauthenticated`)

`application/json`

- `errors` (object[])
  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

#### curl

```curl
curl -X DELETE "${API_URL}/users/auth/keys/_all" \
  -u "${USERNAME}:${PASSWORD}" \
  -H "Content-Type: application/json" \
  -d '{
    "user_api_keys": [
      {
        "user_id": "string",
        "api_key_id": "string"
      }
    ]
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{}
```

#### 401

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

