Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Perform Grafana operations using the Grafana HTTP API via curl. Use for querying dashboards, datasources, alerts, and annotations.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 64% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 205% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 91% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 120% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 6% | 0% |
Use the instance and rules below when constructing all Grafana API commands.
Update the table below with your Grafana instance URLs and corresponding token file paths:
| Environment | Base URL | Token File | |---|---|---| | Production | https://<your-grafana-prod-url> | ~/.grafana/prod.token | | Staging | https://<your-grafana-staging-url> | ~/.grafana/staging.token |
If the target instance is unclear, ask the user before running any command.
Generate a Grafana API token for each instance you intend to use and save it to the corresponding token file (see instance table above). Never print or display token values. Do not perform these steps yourself.
For each instance:
<BASE_URL> → Administration → Users and access → Service accounts → Add service accountbashmkdir -p ~/.grafana && echo "<your-api-token>" > <TOKEN_FILE> && chmod 600 <TOKEN_FILE>
All API calls use curl with the token read from the instance's token file (see instance table above):
bashcurl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \ "<BASE_URL>/api/<endpoint>" | jq .
Example (production):
bashcurl -s -H "Authorization: Bearer $(cat ~/.grafana/prod.token)" \ "https://<your-grafana-prod-url>/api/health" | jq .
| Endpoint | Method | Description | |---|---|---| | /api/org | GET | Get current organisation info | | /api/user | GET | Get current authenticated user | | /api/datasources | GET | List all datasources | | /api/datasources/<id> | GET | Get datasource by ID | | /api/dashboards/home | GET | Get the home dashboard | | /api/search?query=<term> | GET | Search dashboards and folders | | /api/dashboards/uid/<uid> | GET | Get dashboard by UID | | /api/folders | GET | List all folders | | /api/folders/<uid> | GET | Get folder by UID | | /api/alerts | GET | List legacy alerts | | /api/v1/provisioning/alert-rules | GET | List all alert rules | | /api/v1/provisioning/alert-rules/<uid> | GET | Get alert rule by UID | | /api/annotations | GET | List annotations | | /api/health | GET | Check Grafana health |
| Endpoint | Method | Description | |---|---|---| | /api/dashboards/db | POST | Create or update a dashboard | | /api/folders | POST | Create a folder | | /api/folders/<uid> | PUT | Update a folder | | /api/annotations | POST | Create an annotation | | /api/annotations/<id> | PUT | Update an annotation | | /api/v1/provisioning/alert-rules | POST | Create an alert rule | | /api/v1/provisioning/alert-rules/<uid> | PUT | Update an alert rule |
| Endpoint | Method | Reason | |---|---|---| | /api/dashboards/uid/<uid> | DELETE | Irreversible dashboard deletion | | /api/folders/<uid> | DELETE | Deletes folder and all its dashboards | | /api/datasources/<id> | DELETE | Removes datasource used by dashboards | | /api/annotations/<id> | DELETE | Irreversible annotation deletion | | /api/v1/provisioning/alert-rules/<uid> | DELETE | Removes alert rule permanently | | /api/admin/users/<id> | DELETE | Deactivates a user account |
$(cat <TOKEN_FILE>) — never hardcode a token value in a command.-s (silent) to curl to suppress progress output, and pipe through jq for readable output.page and perpage fields and iterate if needed.Other measured skills in the registry, with their headline benchmark lift.