| 12345678910111213141516171819202122232425262728293031323334353637383940 | --:api: create-api-key:request: CreateApiKeyRequest:response: CreateApiKeyResponse--[role="xpack"][id="{upid}-{api}"]=== Create API Key APIAPI Key can be created using this API.[id="{upid}-{api}-request"]==== Create API Key RequestA +{request}+ contains an optional name for the API key,an optional list of role descriptors to define permissions andoptional expiration for the generated API key.If expiration is not provided then by default the APIkeys do not expire.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------include::../execution.asciidoc[][id="{upid}-{api}-response"]==== Create API Key ResponseThe returned +{response}+ contains an id,API key, name for the API key and optionalexpiration.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> the API key credentials that can be used to authenticate to Elasticsearch.<2> expiration if the API keys expire
 |