Get service accounts API

Get service accounts API

Retrieves information about service accounts.

Currently, only the elastic/fleet-server service account is available.

Request

GET /_security/service

GET /_security/service/<namespace>

GET /_security/service/<namespace>/<service>

Prerequisites

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

Description

This API returns a list of service accounts that match the provided path parameter(s).

Path parameters

namespace

(Optional, string) Name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the service parameter.

service

(Optional, string) Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified namespace.

Response body

A successful call returns a JSON object of service accounts. The API returns an empty object if no service account is found.

Examples

To following request retrieves a service account for the elastic/fleet-server service account:

  1. GET /_security/service/elastic/fleet-server
  1. {
  2. "elastic/fleet-server": {
  3. "role_descriptor": {
  4. "cluster": [
  5. "monitor",
  6. "manage_own_api_key"
  7. ],
  8. "indices": [
  9. {
  10. "names": [
  11. "logs-*",
  12. "metrics-*",
  13. "traces-*",
  14. "synthetics-*",
  15. ".logs-endpoint.diagnostic.collection-*",
  16. ".logs-endpoint.action.responses-*"
  17. ],
  18. "privileges": [
  19. "write",
  20. "create_index",
  21. "auto_configure"
  22. ],
  23. "allow_restricted_indices": false
  24. },
  25. {
  26. "names": [
  27. ".fleet-*"
  28. ],
  29. "privileges": [
  30. "read",
  31. "write",
  32. "monitor",
  33. "create_index",
  34. "auto_configure",
  35. "maintenance"
  36. ],
  37. "allow_restricted_indices": false
  38. }
  39. ],
  40. "applications": [
  41. {
  42. "application" : "kibana-*",
  43. "privileges" : [
  44. "reserved_fleet-setup"
  45. ],
  46. "resources" : [
  47. "*"
  48. ]
  49. }
  50. ],
  51. "run_as": [],
  52. "metadata": {},
  53. "transient_metadata": {
  54. "enabled": true
  55. }
  56. }
  57. }
  58. }

Omit the namespace and service to retrieve all service accounts:

  1. GET /_security/service