Grafana Screenshot through API


I am trying to create a screenshot of a particular panel within my dashboard through grafana API. But i am not sure how to do that.

My Aim is to get the screenshot url through api and send the url to users.


click panel title then share, opens share modal, in this modal you find the direct link to rendered image:

Check the url for this link, that is the render API

This actually does not work very well. E.g. I tried to use python code to download screenshot and it downloaded just white stripe. Does anybody here have solution how to get screenshot from grafana using python or curl? (I would like this to work without GUI, selenium required GUI and it was the only one working program, but it just made a screenshot of login page… even though I used link generated when I use share button (pre-rendered image))
Here are several options what I’ve tried.

import imgkit

from selenium import webdriver
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
screenshot = driver.save_screenshot('my_screenshot.png')

    from urllib.request import urlopen  # py3
except ImportError:
    from urllib2 import urlopen  # py2
import json

url = 'http://192.XX.XX.XX:XXXX/render/dashboard-solo/db/new-dashboard?orgId=1&panelId=3&from=1530528819708&to=1533120819708&width=1000&height=500&tz=UTC%2B02%3A00'

response = urlopen(url)
data_str =
data = json.loads(data_str)


Ok, I figured this out.
curl 'http://<IP>:<PORT>/render/dashboard-solo/db/<DASHBOARD_NAME>?refresh=5m&orgId=1&panelId=<TAB_ID>&width=300&height=300&tz=UTC%202%3A00' -H 'Authorization: Bearer <API_KEY>' --compressed > OUTPUT.png

Before this you must generate API key in grafana settings