Create a service account token
- POST also PUT /_security/service/{namespace}/{service}/credential/token/{name}
- POST /_security/service/{namespace}/{service}/credential/token
Create a service accounts token for access without requiring basic authentication.
This route serves both kinds of service account, but the privileges differ: manage_service_account authorizes tokens of built-in accounts in the elastic namespace only, and tokens of a user-managed account require manage_security.
Note
Service account tokens never expire. You must actively delete them if they are no longer needed.
Important
On Serverless, non-operator users can create tokens for only elastic/fleet-server and elastic/fleet-server-remote.
Creating tokens for any other service account requires operator privileges.