Grafana API – Export Graph as png image

How to export a Grafana Graph as a png image? Step 1) Create your own API Keys 2) Get the Graph URL 3) Export Command

Create your API Key

  • click on the grafana icon at the top left corner and go to Admin (Main Org.) -> API Keys
  • add a new key (example: name=export role=viewer)
  • then you will receive your api key (eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9)

Get the graph url

  • click on the name of the graph you want to export to a png file
  • select share and copy the url of the „direct link rendered image“ link


Put together your export command

You can use curl to download the image file. You will have to set a Bearer token to authenticate.

curl -H „Authorization: Bearer eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9“ „“ > filename.png

now you can execute your own command and your png file is getting saved to your directory

Example of a exported graph

grafana export png


8 Kommentare zu „Grafana API – Export Graph as png image“

  1. curl -H “Authorization: Bearer eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9” “” > filename.png

    where to execute the above command?

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen