Grafana Cloud APIs
There are two API systems you can use to work with your Grafana Cloud environment. The Grafana Cloud API allows you to manage resources at the organizational level, such as creating a stack and restarting a Grafana instance. The Grafana HTTP API allows you to manage resources for a Grafana Cloud stack, such as creating a dashboard or setting folder permissions. To work with either API, you must create API keys. Only users with the Admin role can create and provision API keys.
Note: Always create API keys for specific tasks, according to the principle of least privilege. It is better to create multiple API keys for a human user account to use, each for specific tasks, than to create and always use an API key with the abilities needed for the most privileged task. In other words, don’t just create an Admin key and use it for everything.
Create a Grafana Cloud API key
To interact programmatically with the Grafana Cloud API, you need an API key with proper permissions.
Note: Only Grafana.com administrators can create or delete API keys. 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 API key to, by selecting from the dropdown in top left.
Click API Keys from the SECURITY section on the left.
Click +Add API Key.
In API Key Name, enter a name for your API key.
In Role, select the user role to associate with this API key. For example, if you want people or software using this key to only have Viewer role permissions, then select Viewer. The roles and permissions available match the Grafana Cloud roles and permissions, with a couple additions:
- MetricsPublisher is only given permission to send log and metric data to Grafana Cloud
- PluginPublisher is only given permission to create and publish plugins
Click Create API Key.
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.
To learn more, see the Grafana Cloud API documentation.
Create a Grafana HTTP API key
Create a Grafana HTTP API key to manage stack resources.
To create a Grafana HTTP API key:
- Log into your Grafana Cloud instance.
- Open settings (Gear icon) and select the API Keys option.
- Click Add API Key.
- In Key Name, enter a name for your API key.
- In Role, select the
Editorrole to associate with this API key.
To learn more, see the Grafana HTTP API documentation.