---
type: api
title: Enable users
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-security-enable-user
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-security-enable-user
products:
  - Elasticsearch
---

# Enable users


Availability:

## Paths

- `POST` (also `PUT`) `/_security/user/{username}/_enable`

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

#### Path Parameters

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

## Description

Enable users in the native realm.
By default, when you create users, they are enabled.

## 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`

Type: `object`

## Code Examples

#### Console

```console
POST _security/user/logstash_system/_enable
```

#### JavaScript

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

#### Python

```python
resp = client.security.enable_user(
    username="logstash_system",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_security/user/logstash_system/_enable" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.security().enableUser(e -> e
    .username("logstash_system")
);
```

#### C#

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

#### PHP

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

#### Ruby

```ruby
response = client.security.enable_user(
  username: "logstash_system"
)
```

