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

# Enable users

Authentication: required

## Paths

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

#### Path parameters

- `username` (string) — required
  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) — optional
  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"
)
```

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

