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

# Enable users


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

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)

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

