Get user profile APIedit

This feature is in development and not yet available for use. This documentation is provided for informational purposes only.

Retrieves a user’s profile using the unique profile ID.

Requestedit

GET /_security/profile/<uid>

Prerequisitesedit

  • To use this API, you must have at least the manage_user_profile cluster privilege.

Descriptionedit

The get user profile API returns the user profile document matching a specified uid, which is generated when activating a user profile.

Path parametersedit

uid
(Required, string) A unique identifier for the user profile.

Query parametersedit

data
(Optional, string) 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 the content nested under the specified <key>. Defaults to returning no content.

Response bodyedit

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.

Examplesedit

GET /_security/profile/u_kd2JMqwUQwSCCOxMv7M1vw

The API returns the following response for a uid matching u_kd2JMqwUQwSCCOxMv7M1vw:

{
  "u_kd2JMqwUQwSCCOxMv7M1vw": {
    "uid": "u_kd2JMqwUQwSCCOxMv7M1vw",
    "enabled": true,
    "last_synchronized": 1642650651037,
    "user": {
      "username": "jacknich",
      "roles": [
        "admin", "other_role1"
      ],
      "realm_name": "native1",
      "full_name": "Jack Nicholson",
      "email": "jacknich@example.com"
    },
    "labels": {},
    "data": {}, 
    "_doc": {
      "_primary_term": 1,
      "_seq_no": 0
    }
  }
}

No content is returned in the data field by default.

The following request retrieves a subset of data that’s nested under the key app1, along with the user’s profile:

GET /_security/profile/u_kd2JMqwUQwSCCOxMv7M1vw?data=app1.key1
{
  "u_kd2JMqwUQwSCCOxMv7M1vw": {
    "uid": "u_kd2JMqwUQwSCCOxMv7M1vw",
    "enabled": true,
    "last_synchronized": 1642650651037,
    "user": {
      "username": "jacknich",
      "roles": [
        "admin", "other_role1"
      ],
      "realm_name": "native1",
      "full_name": "Jack Nicholson",
      "email": "jacknich@example.com"
    },
    "labels": {},
    "data": {
      "app1": {
        "key1": "value1"
      }
    },
    "_doc": {
      "_primary_term": 1,
      "_seq_no": 0
    }
  }
}