Skip to content

Instantly share code, notes, and snippets.

@crisidev
Created October 7, 2015 20:35
Show Gist options
  • Save crisidev/bd52bdcc7f029be2f295 to your computer and use it in GitHub Desktop.
Save crisidev/bd52bdcc7f029be2f295 to your computer and use it in GitHub Desktop.
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done
@aalzoladatadope
Copy link

aalzoladatadope commented Jul 22, 2025

Hi all,

I'm looking for a way to export the actual panel data from Grafana — not just the dashboard or panel JSON definitions.
Basically, I want to automate what we can manually do via:

Right-click panel → Inspect → Data → Download CSV

Ideally, I’d like to do this recursively for all panels in a dashboard using a script (e.g. via API).
Has anyone done something similar or found a reliable method to achieve this?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment