Skip to content

Commit ddc470c

Browse files
authored
Docs for Get API key active_only flag (#98313)
Docs for #98259.
1 parent 225503a commit ddc470c

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

x-pack/docs/en/rest-api/security/get-api-keys.asciidoc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Retrieves information for one or more API keys.
1515
[[security-api-get-api-key-prereqs]]
1616
==== {api-prereq-title}
1717

18-
* To use this API, you must have at least the `manage_own_api_key` or the
18+
* To use this API, you must have at least the `manage_own_api_key` or the
1919
`read_security` cluster privileges.
2020
** If you only have the `manage_own_api_key` privilege, this API only returns
21-
the API keys that you own.
21+
the API keys that you own.
2222
+
2323
NOTE: Authenticating with an API key that has the `manage_own_api_key` privilege
24-
does not allow retrieving the authenticated user's own keys. Instead,
24+
does not allow retrieving the authenticated user's own keys. Instead,
2525
authenticate the user with basic credentials.
2626
** If you have `read_security`, `manage_api_key` or greater
2727
privileges (including `manage_security`), this API returns all API keys
@@ -67,6 +67,12 @@ associated with the API key. An API key's actual permission is the intersection
6767
its <<api-key-role-descriptors,assigned role descriptors>> and the owner user's role descriptors
6868
(effectively limited by it). An API key must have `manage_api_key` or higher privileges to retrieve the limited-by role descriptors of any API key, including itself.
6969

70+
`active_only`::
71+
(Optional, Boolean) A boolean flag that can be used to query API keys that are currently active.
72+
An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together
73+
with other parameters such as `owner` or `name`. If `active_only` is `false`, the response will
74+
include both active and inactive (expired or invalidated) keys. Defaults to `false`.
75+
7076
NOTE: When none of the parameters "id", "name", "username" and "realm_name"
7177
are specified, and the "owner" is set to false then it will retrieve all API
7278
keys if the user is authorized. If the user is not authorized to retrieve other user's
@@ -230,6 +236,13 @@ GET /_security/api_key
230236
--------------------------------------------------
231237
// TEST[continued]
232238

239+
The following example retrieves all active API keys if the user is authorized to do so:
240+
[source,console]
241+
--------------------------------------------------
242+
GET /_security/api_key?active_only=true
243+
--------------------------------------------------
244+
// TEST[continued]
245+
233246
Following creates an API key
234247

235248
[source,console]

0 commit comments

Comments
 (0)