Get Roles API
Introduced 1.0
Retrieves roles. Specify a role name to retrieve one role, or omit the role name to retrieve all roles.
Endpoints
GET /_plugins/_security/api/roles
GET /_plugins/_security/api/roles/{role}
Path parameters
The following table lists the available path parameters.
| Parameter | Data type | Required | Description |
|---|---|---|---|
role | String | No | The name of the role to retrieve. If omitted, all roles are returned. |
Example request
The following request retrieves all roles:
GET _plugins/_security/api/roles
The following request retrieves the test-role role:
GET _plugins/_security/api/roles/test-role
Example response
The response is abbreviated here:
{
"observability_read_access": {
"cluster_permissions": [
"cluster:admin/opensearch/observability/get"
],
"hidden": false,
"index_permissions": [],
"reserved": true,
"static": false,
"tenant_permissions": []
},
...
}
The response to a request for one role contains only that role:
{
"test-role": {
"cluster_permissions": [
"cluster_composite_ops",
"indices_monitor"
],
"hidden": false,
"index_permissions": [
{
"allowed_actions": [
"read"
],
"dls": "",
"fls": [],
"index_patterns": [
"movies*"
],
"masked_fields": []
}
],
"reserved": false,
"static": false,
"tenant_permissions": [
{
"allowed_actions": [
"kibana_all_read"
],
"tenant_patterns": [
"human_resources"
]
}
]
}
}