Create Grafana Cloud API keys
There are two API systems you can use to work with your Grafana Cloud environment. The Grafana Cloud API lets you manage resources at the organizational level, such as creating a stack and restarting a Grafana instance. The Grafana HTTP API lets you manage resources for the Grafana instance in your Grafana Cloud stack, such as creating a dashboard or setting folder permissions. To work with either API, you must create tokens.
Note: Always create tokens for specific tasks, according to the principle of least privilege. It is better to create multiple tokens for a human user account to use, each for specific tasks, than to create and always use a token with the abilities needed for the most privileged task. In other words, don’t just create a single token and use it for everything.
Create a Grafana Cloud Access Policy
To interact programmatically with the Grafana Cloud API, you need an access policy.
Note: Only Grafana.com admins can create or delete access policies in the Cloud Portal. See Grafana Cloud roles and permissions for more information.
- Log into your Grafana Cloud account to access the Cloud Portal.
- Select the organization that you want to add an access policy to, by selecting from the dropdown in top left.
- Click Access Policies from the SECURITY section on the left.
- Click Create access policy.
- In Display name, enter a name for your access policy.
- In Realm, select either your entire organization, or individual stack. See Realms for more information.
- In Scopes, select which permissions the access policy should have. See Scopes for more information.
- Click Create.
- Locate the access policy, and click Add token.
- In Token name, enter a name for you token.
- Click Create.
- A token is created and displayed. Copy the token and store it in a safe place, because it will not be displayed again.
- Click Close when finished.
Create a Grafana HTTP API key
Create a Grafana HTTP API key to manage your Grafana Cloud instance resources.
To create a Grafana HTTP API key:
- Log into your Grafana Cloud instance.
- Click Administration in the left-side menu and select API keys.
- Click Add API Key.
- In Key Name, enter a name for your API key.
- In the Role dropdown, select Admin or Editor to associate with this API key.
To learn more, see the Grafana HTTP API documentation.