Get user profile API

edit

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

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

Request

edit

GET /_security/profile/<uid>

Prerequisites

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

Description

edit

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

Path parameters

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

Query parameters

edit
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 body

edit

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.

Examples

edit
GET /_security/profile/u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0

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

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

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_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0?data=app1.key1
{
  "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0": {
    "uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
    "enabled": true,
    "last_synchronized": 1642650651037,
    "user": {
      "username": "jacknich",
      "roles": [
        "admin", "other_role1"
      ],
      "realm_name": "native",
      "full_name": "Jack Nicholson",
      "email": "[email protected]"
    },
    "labels": {
      "direction": "north"
    },
    "data": {
      "app1": {
        "key1": "value1"
      }
    },
    "_doc": {
      "_primary_term": 88,
      "_seq_no": 66
    }
  }
}