
--
:api: get-service-account-credentials
:request: GetServiceAccountCredentialsRequest
:response: GetServiceAccountCredentialsResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Get Service Account Credentials API

[id="{upid}-{api}-request"]
==== Get Service Account Credentials Request

Retrieving all credentials for a service account can be performed by setting the namespace
and service-name on +{request}+:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------

include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Get Service Account Credentials Response

The returned +{response}+ contains service tokens for the requested service account.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> Principal of the service account
<2> List of index-based service token information
<3> Name of the first service token
<4> Source of the first service token. The value is either `file` or `index`.
<5> For `file` service tokens, names of the nodes where the information is collected.
<6> List of file-based service token information
<7> Response header containing the information about the execution of collecting `file` service tokens.
<8> Number of nodes that successful complete the request of retrieving file-backed service tokens
<9> Number of nodes that fail to complete the request of retrieving file-backed service tokens

