---
type: api
title: Delete users
description: Delete users from the native realm.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-security-delete-user
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-security-delete-user
products:
  - Elasticsearch
---

# Delete users

Availability:

## Paths

- `DELETE` `/_security/user/{username}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

#### Path Parameters

- `username` (string)
  An identifier for the user.

## Description

Delete users from the native realm.

## Required authorization

* Cluster privileges: `manage_security`

## Query String Parameters

- `refresh` (enum Refresh)
  If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.
  Values: `true`, `false`, `wait_for`

## Response

`application/json`

- `found` (boolean)
  If the user is successfully deleted, the request returns `{"found": true}`.
Otherwise, `found` is set to `false`.
## Code Examples

#### Console

```console
DELETE /_security/user/jacknich
```

#### JavaScript

```javascript
const response = await client.security.deleteUser({
  username: "jacknich",
});
```

#### Python

```python
resp = client.security.delete_user(
    username="jacknich",
)
```

#### curl

```curl
curl -X DELETE "$ELASTICSEARCH_URL/_security/user/jacknich" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.security().deleteUser(d -> d
    .username("jacknich")
);
```

#### C#

```c#
var response = await client.Security.DeleteUserAsync(username: "jacknich");
```

#### PHP

```php
$resp = $client->security()->deleteUser([
    "username" => "jacknich",
]);
```

#### Ruby

```ruby
response = client.security.delete_user(
  username: "jacknich"
)
```

## Response Examples

#### Security delete user response example1

A successful response from `DELETE /_security/user/jacknich`.

```json
{
  "found" : true
}
```

