[[reference-security-query_api_keys]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.security.queryApiKeys

Find API keys with a query. Get a paginated list of API keys and their information. You can optionally filter the results with a query.

{ref}/security-api-query-api-key.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(SecurityQueryApiKeysRequest, options?): Promise<SecurityQueryApiKeysResponse>
----

[discrete]
===== `SecurityQueryApiKeysRequest`

[source,ts]
----
interface SecurityQueryApiKeysRequest extends <<shared-type-request-base, RequestBase>> {
  with_limited_by?: boolean
  with_profile_uid?: boolean
  typed_keys?: boolean
  aggregations?: Record<string, SecurityQueryApiKeysApiKeyAggregationContainer>
  /** @alias aggregations */
  aggs?: Record<string, SecurityQueryApiKeysApiKeyAggregationContainer>
  query?: SecurityQueryApiKeysApiKeyQueryContainer
  from?: <<shared-type-integer, integer>>
  sort?: <<shared-type-sort, Sort>>
  size?: <<shared-type-integer, integer>>
  search_after?: <<shared-type-sort-results, SortResults>>
}
----

[discrete]
===== `SecurityQueryApiKeysResponse`

[source,ts]
----
interface SecurityQueryApiKeysResponse {
  total: <<shared-type-integer, integer>>
  count: <<shared-type-integer, integer>>
  api_keys: SecurityApiKey[]
  aggregations?: Record<<<shared-type-aggregate-name, AggregateName>>, SecurityQueryApiKeysApiKeyAggregate>
}
----

