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

# Get users


Availability:

## Paths

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

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

#### Path Parameters

- `username` (union Username | [] Username) — optional, leave it out to use `/_security/user`
  An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users.

## Description

Get information about users in the native realm and built-in users.

## Required authorization

* Cluster privileges: `read_security`

## Query String Parameters

- `with_profile_uid` (boolean · default: false)
  Determines whether to retrieve the user profile UID, if it exists, for the users.

## Response

`application/json`

Type: `map string to User`

## Code Examples

#### Console

```console
GET /_security/user/jacknich?with_profile_uid=true
```

#### JavaScript

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

#### Python

```python
resp = client.security.get_user(
    username="jacknich",
    with_profile_uid=True,
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.security().getUser(g -> g
    .username("jacknich")
    .withProfileUid(true)
);
```

#### C#

```c#
var response = await client.Security
    .GetUserAsync(d1 => d1
        .Username(["jacknich"])
        .WithProfileUid(true)
    );
```

#### PHP

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

#### Ruby

```ruby
response = client.security.get_user(
  username: "jacknich",
  with_profile_uid: "true"
)
```

## Response Examples

#### Security get user response example1

A successful response from `GET /_security/user/jacknich?with_profile_uid=true`. It includes the user `profile_uid` as part of the response.

```json
{
  "jacknich": {
    "username": "jacknich",
    "roles": [
      "admin", "other_role1"
    ],
    "full_name": "Jack Nicholson",
    "email": "jacknich@example.com",
    "metadata": { "intelligence" : 7 },
    "enabled": true,
    "profile_uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"
  }
}
```

