| 123456789101112131415161718192021222324252627282930313233343536373839404142 | --:api: create-service-account-token:request: CreateServiceAccountTokenRequest:response: CreateServiceAccountTokenResponse--[role="xpack"][id="{upid}-{api}"]=== Create Service Account Token APIIndex-based service account token can be created using this API.[id="{upid}-{api}-request"]==== Create Service Account Token RequestA +{request}+ contains the namespace and service-name of aservice account and an optional name for the service account token.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------A token name will be auto generated if the +{request}+ does not specify it:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request-auto-name]--------------------------------------------------include::../execution.asciidoc[][id="{upid}-{api}-response"]==== Create Service Account Token ResponseThe returned +{response}+ contains the name and value of the service account token.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> Name of the service account token<2> Value of the service account token to be used as the bearer authentication header
 |