POST /api/fleet/service_tokens

Spaces method and path for this operation:

post /s/{space_id}/api/fleet/service_tokens

Refer to Spaces for more information.

Create a Fleet Server service token. The token is used to enroll Fleet Server instances with Kibana.

[Required authorization] Route required privileges: fleet-agents-all.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • remote boolean

    Default value is false.

Responses

  • 200 application/json

    Successful response

    Hide response attributes Show response attributes object
    • name string Required
    • value string Required
  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • attributes Required
    • error string
    • errorType string
    • message string Required
    • statusCode number
POST /api/fleet/service_tokens
curl \
 --request POST 'https://<KIBANA_URL>/api/fleet/service_tokens' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --header "kbn-xsrf: true" \
 --data '{"remote":true}'
Request example
Generate a service token for a remote Fleet Server
{
  "remote": true
}
Response examples (200)
The generated Fleet Server service token
{
  "name": "elastic/fleet-server/token-1234567890",
  "value": "AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTEyMzQ1Njc4OTA6QUJDREVGR0hJSktMTU5P"
}
Response examples (400)
Example of a generic error response
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}