Grafana CLI
Dashboards Commands
Export, import, and manage Grafana dashboards using the grafana-cli and API.
8 commands
Pro Tips
Use --overwrite when importing updated dashboards
Commands
Export dashboard
$ curl -s http://localhost:3000/api/dashboards/uid/DASHBOARD_UID -H 'Authorization: Bearer TOKEN' | jq '.dashboard' > dashboard.json
Export dashboard to JSON.
Import dashboard
$ curl -X POST http://localhost:3000/api/dashboards/db -H 'Content-Type: application/json' -H 'Authorization: Bearer TOKEN' -d @dashboard.json
Import dashboard from JSON.
List dashboards
$ curl -s http://localhost:3000/api/search -H 'Authorization: Bearer TOKEN'
List all dashboards.
Delete dashboard
$ curl -X DELETE http://localhost:3000/api/dashboards/uid/DASHBOARD_UID -H 'Authorization: Bearer TOKEN'
Delete a dashboard.
Search dashboards by query
$ curl -s 'http://localhost:3000/api/search?query=cpu' -H 'Authorization: Bearer TOKEN'
Search dashboards by keyword.
Get dashboard versions
$ curl -s http://localhost:3000/api/dashboards/id/1/versions -H 'Authorization: Bearer TOKEN'
List version history of a dashboard.
Get dashboard permissions
$ curl -s http://localhost:3000/api/dashboards/uid/DASHBOARD_UID/permissions -H 'Authorization: Bearer TOKEN'
View dashboard access permissions.
List folders
$ curl -s http://localhost:3000/api/folders -H 'Authorization: Bearer TOKEN'
List all dashboard folders.