---
type: api
title: Get a user profile
description: Get a user's profile using the unique profile ID.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-security-get-user-profile
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-security-get-user-profile
products:
  - Elasticsearch
---

# Get a user profile

Availability: Generally available since 8.2

## Paths

- `GET` `/_security/profile/{uid}`

#### Path parameters

- `uid` (union string | string[]) — required
  A unique identifier for the user profile.

## Description

Get a user's profile using the unique profile ID.

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
Individual users and external applications should not call this API directly.
Elastic reserves the right to change or remove this feature in future releases without prior notice.

## Required authorization

- Cluster privileges: `read_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

- `data` (union string | string[]) — optional
  A comma-separated list of filters for the `data` field of the profile document.
To return all content use `data=*`.
To return a subset of content use `data=<key>` to retrieve content nested under the specified `<key>`.
By default returns no `data` content.

## Response

`application/json`

- `profiles` (object[])
  A successful call returns the JSON representation of the user profile and its internal versioning numbers.
The API returns an empty object if no profile document is found for the provided `uid`.
The content of the data field is not returned by default to avoid deserializing a potential large payload.
  - `uid` (string)
  - `user` (object)
    - `email` (union string) — nullable
      One of: `string`
    - `full_name` (union string) — nullable
    - `realm_name` (string)
    - `realm_domain` (string)
    - `roles` (string[])
    - `username` (string)
  - `data` (map string to object)
  - `labels` (map string to object)
  - `enabled` (boolean)
  - `last_synchronized` (number)
  - `_doc` (object)
    - `_primary_term` (number)
    - `_seq_no` (number)
- `errors` (object)
  - `count` (number)
  - `details` (map string to object)
    Map values (object)
    - `type` (string)
      The type of error
    - `reason` (union string) — nullable
      A human-readable explanation of the error, in English.
      One of: `string`
    - `stack_trace` (string)
      The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
    - `caused_by` (object) — recursive
    - `root_cause` (object[]) — recursive
    - `suppressed` (object[]) — recursive
## Code examples

#### Console

```console
GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0
```

#### JavaScript

```javascript
const response = await client.security.getUserProfile({
  uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
});
```

#### Python

```python
resp = client.security.get_user_profile(
    uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.security().getUserProfile(g -> g
    .uid("u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0")
);
```

#### C#

```c#
var response = await client.Security.GetUserProfileAsync(uid: ["u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"]);
```

#### PHP

```php
$resp = $client->security()->getUserProfile([
    "uid" => "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
]);
```

#### Ruby

```ruby
response = client.security.get_user_profile(
  uid: "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"
)
```

## Response examples

#### Profile details for a UUID

A successful response from `GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0`. By default, no content is returned in the `data` field.

```json
{
  "profiles": [
    {
      "uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
      "enabled": true,
      "last_synchronized": 1642650651037,
      "user": {
        "username": "jacknich",
        "roles": [
          "admin", "other_role1"
        ],
        "realm_name": "native",
        "full_name": "Jack Nicholson",
        "email": "jacknich@example.com"
      },
      "labels": {
        "direction": "north"
      },
      "data": {}, 
      "_doc": {
        "_primary_term": 88,
        "_seq_no": 66
      }
    }
  ]
}
```

#### Profile details for a UUID and data key

A successful response from `GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0?data=app1.key1`.

```json
{
  "profiles": [
    {
      "uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
      "enabled": true,
      "last_synchronized": 1642650651037,
      "user": {
        "username": "jacknich",
        "roles": [
          "admin", "other_role1"
        ],
        "realm_name": "native",
        "full_name": "Jack Nicholson",
        "email": "jacknich@example.com"
      },
      "labels": {
        "direction": "north"
      },
      "data": {
        "app1": {
          "key1": "value1"
        }
      },
      "_doc": {
        "_primary_term": 88,
        "_seq_no": 66
      }
    }
  ]
}
```

#### Profile details with errors

A response that contains errors that occurred while retrieving user profiles.

```json
{
  "profiles": [],
  "errors": {
    "count": 1,
    "details": {
      "u_FmxQt3gr1BBH5wpnz9HkouPj3Q710XkOgg1PWkwLPBW_5": {
        "type": "resource_not_found_exception",
        "reason": "profile document not found"
      }
    }
  }
}
```

