---
type: api
title: Deletes an existing user
description: Deletes an existing user.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-user
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-user
products:
  - Elastic Cloud Enterprise
---

# Deletes an existing user

## Paths

- `DELETE` `/users/{user_name}`

- [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_name` (string)
  Identifier for the user

## Description

Deletes an existing user.

## Responses

#### `200`

User successfully deleted

`application/json`

Type: `EmptyResponse`

#### `400`

* The user cannot be deleted. (code: `user.restricted_deletion`)
* External users cannot be modified. (code: `user.cannot_modify_external`)
* Built-in users cannot be modified. (code: `user.cannot_modify`)

`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

#### `404`

User not found. (code: `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_name}
```

#### curl

```curl
curl -X DELETE "/users/{user_name}"
```

