Add a token to a service account in Grafana
A service account token is a randomly generated string that external system use to authenticate into Grafana, and include specific permissions to interact with the Grafana HTTP APIs. For more information about service accounts, refer to About service accounts in Grafana.
You can create a service account token using the Grafana UI or via the API. For more information about creating a service account token via the API, refer to HTTP API Create service account token.
Before you begin
- Ensure you have added the
serviceAccounts
feature toggle to Grafana. For more information about adding the feature toggle, refer to Enable service accounts. - Ensure you have permission to create and edit service accounts. By default, the organization administrator role is required to create and edit service accounts. For more information about user permissions, refer to About users and permissions.
To add a token to a service account
- Sign in to Grafana, then hover your cursor over Configuration (the gear icon) in the sidebar.
- Click Service accounts.
- Click the service account to which you want to add a token.
- Click Add token.
- Enter a name for the token.
- (recommended) Enter an expiry date and expiry date for the token or leave it on no expiry date option.
- The expiry date specifies how long you want the key to be valid.
- If you are unsure of an expiration date, we recommend that you set the token to expire after a short time, such as a few hours or less. This limits the risk associated with a token that is valid for a long time.
- Click Generate service account token.
Related Grafana resources
Getting started with Grafana 8
Grafana 8.0 is here! Join us for a live walkthrough on how to get started using Grafana 8 and the Grafana 8 user interface while showing how to set up monitoring for a web service that uses Prometheus and Loki to store metrics and logs.
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.