---
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/4371/api/doc/elasticsearch/v8/operation/operation-security-get-user-profile
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-security-get-user-profile
products:
  - Elasticsearch
---

# Get a user profile

Availability: 8.2+

## Paths

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

- [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

- `uid` (union UserProfileId | [] UserProfileId)
  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`

## Query String Parameters

- `data` (union string | [] string)
  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.
  One of: `string` or `string[]`

## Response

`application/json`

- `profiles` ([] UserProfileWithMetadata)
  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` ({} UserProfileUser)
    - `email` (union string) — nullable
      One of: `string`
    - `full_name` (union Name | string) — nullable
    - `realm_name` (string Name)
    - `realm_domain` (string Name)
    - `roles` ([] string)
    - `username` (string)
  - `data` (map string to object)
  - `labels` (map string to object)
  - `enabled` (boolean)
  - `last_synchronized` (number)
  - `_doc` ({} UserProfileHitMetadata)
    - `_primary_term` (number)
    - `_seq_no` (number SequenceNumber)
- `errors` ({} GetUserProfileErrors)
  - `count` (number)
  - `details` (map string to ErrorCause)
    Map values ({} ErrorCause)
    - `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` ({} ErrorCause) — recursive
    - `root_cause` ([] ErrorCause) — recursive
    - `suppressed` ([] ErrorCause) — 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"
      }
    }
  }
}
```

