Create an API key in Grafana
Create an API key when you want to manage your computed workload with a user.
For more information about API keys, refer to About API keys in Grafana.
This topic shows you how to create an API key using the Grafana UI. You can also create an API key using the Grafana HTTP API. For more information about creating API keys via the API, refer to Create API key via API.
Before you begin:
- Ensure you have permission to create and edit API keys. For more information about permissions, refer to About users and permissions.
To create an API key:
- Sign in to Grafana, hover your cursor over Configuration (the gear icon), and click API Keys.
- Click New API key.
- Enter a unique name for the key.
- In the Role field, select one of the following access levels you want to assign to the key.
- Admin: Enables a user to use APIs at the broadest, most powerful administrative level.
- Editor or Viewer to limit the key’s users to those levels of power.
- In the Time to live field, specify how long you want the key to be valid.
- The maximum length of time is 30 days (one month). You enter a number and a letter. Valid letters include
s
for seconds,m
for minutes,h
for hours,d
for days,w
for weeks, andM
for month. For example,12h
is 12 hours and1M
is 1 month (30 days). - If you are unsure about how long an API key should be valid, we recommend that you choose a short duration, such as a few hours. This approach limits the risk of having API keys that are valid for a long time.
- The maximum length of time is 30 days (one month). You enter a number and a letter. Valid letters include
- Click Add.