Get users API

Retrieves information about users in the native realm and built-in users.

Request

GET /_security/user

GET /_security/user/<username>

Prerequisites

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

Description

For more information about the native realm, see Realms and Native user authentication.

Path parameters

username

(Optional, 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.

Response body

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

Response codes

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

Examples

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

  1. GET /_security/user/jacknich
  1. {
  2. "jacknich": {
  3. "username": "jacknich",
  4. "roles": [
  5. "admin", "other_role1"
  6. ],
  7. "full_name": "Jack Nicholson",
  8. "email": "jacknich@example.com",
  9. "metadata": { "intelligence" : 7 },
  10. "enabled": true
  11. }
  12. }

Omit the username to retrieve all users:

  1. GET /_security/user