Get users API

edit

Retrieves information about users in the native realm.

Request

edit

GET /_xpack/security/user

GET /_xpack/security/user/<username>

Description

edit

For more information about the native realm, see Realms and Configuring a native realm.

Path Parameters

edit
username
(string) 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.

Authorization

edit

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

Examples

edit

To retrieve a native user, submit a GET request to the /_xpack/security/user/<username> endpoint:

GET /_xpack/security/user/jacknich

A successful call returns an array of users with the JSON representation of the user. Note that user passwords are not included.

{
  "jacknich": {
    "username": "jacknich",
    "roles": [
      "admin", "other_role1"
    ],
    "full_name": "Jack Nicholson",
    "email": "[email protected]",
    "metadata": { "intelligence" : 7 },
    "enabled": true
  }
}

If the user is not defined in the native realm, the request 404s.

Omit the username to retrieve all users:

GET /_xpack/security/user