Path parameters
- id
string Required The ID of the API key to update.
Body
- role_descriptors
object The role descriptors to assign to this API key. The API key's effective permissions are an intersection of its assigned privileges and the point in time snapshot of permissions of the owner user. You can assign new privileges by specifying them in this parameter. To remove assigned privileges, you can supply an empty
role_descriptors
parameter, that is to say, an empty object{}
. If an API key has no assigned privileges, it inherits the owner user's full permissions. The snapshot of the owner's permissions is always updated, whether you supply therole_descriptors
parameter or not. The structure of a role descriptor is the same as the request for the create API keys API. - metadata
object - expiration
string A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
curl \
--request PUT 'http://api.example.com/_security/api_key/{id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"role_descriptors\": {\n \"role-a\": {\n \"indices\": [\n {\n \"names\": [\"*\"],\n \"privileges\": [\"write\"]\n }\n ]\n }\n },\n \"metadata\": {\n \"environment\": {\n \"level\": 2,\n \"trusted\": true,\n \"tags\": [\"production\"]\n }\n }\n}"'
{
"role_descriptors": {
"role-a": {
"indices": [
{
"names": ["*"],
"privileges": ["write"]
}
]
}
},
"metadata": {
"environment": {
"level": 2,
"trusted": true,
"tags": ["production"]
}
}
}
{
"role_descriptors": {}
}
{
"updated": true
}