[role="xpack"]
[[security-api-clear-role-cache]]
=== Clear roles cache API
++++
<titleabbrev>Clear roles cache</titleabbrev>
++++

Evicts roles from the native role cache. 

[[security-api-clear-role-cache-request]]
==== {api-request-title}

`POST /_security/role/<roles>/_clear_cache` 

[[security-api-clear-role-cache-prereqs]]
==== {api-prereq-title}

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

[[security-api-clear-role-cache-desc]]
==== {api-description-title}

For more information about the native realm, see 
<<realms>> and <<native-realm>>. 

[[security-api-clear-role-cache-path-params]]
==== {api-path-parms-title}

`<roles>`::
(Required, string)
Comma-separated list of roles to evict from the role cache. To evict all
roles, use `*`. Does not support other wildcard patterns.

[[security-api-clear-role-cache-example]]
==== {api-examples-title}

The clear roles cache API evicts roles from the native role cache. For example, 
to clear the cache for `my_admin_role`:

[source,console]
--------------------------------------------------
POST /_security/role/my_admin_role/_clear_cache
--------------------------------------------------

Specify multiple roles as a comma-separated list.

[source,console]
----
POST /_security/role/my_admin_role,my_test_role/_clear_cache
----

To clear all roles from the cache, use `*`.

[source,console]
----
POST /_security/role/*/_clear_cache
----
