Export dashboard for external use via HTTP API

Hi Grafana!

  • What Grafana version and what operating system are you using?
    7.5.5 and 8.0.6

  • What are you trying to achieve?
    Export dashboards for sharing externally via HTTP API

  • How are you trying to achieve it?
    curl -s -b “$COOKIE” “$HOST/api/dashboards/uid/$dash”

  • What happened?
    Dashboard is exported without __inputs or named datasources

  • What did you expect to happen?
    I hoped there would be an option in the API to export for sharing externally, but I didn’t find it.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors, none expected

  • Did you follow any online instructions? If so, what is the URL?
    Dashboard HTTP API | Grafana documentation

I found these very similar requests (no response) from 2 and 3 years ago(apologies for not including the actual links, I’m not allowed to do that yet):
I am hopeful that this indicates that I missed something trivial, that would be typical.

Thanks very much in advance!


@jeremybz did you ever found the answer? This is a very valid question and I’m surprised it doesn’t attract more interest.

1 Like

Hi @glep207, unfortunately I have not yet found a solution for this.

Hi Jeremy,

are you aiming to export the JSON representation or the bitmap image of the dashboard?

With kind regards,

Hi Andreas,
My goal is to use the API to get the JSON representation of a dashboard, including __inputs and named datasources.
Interestingly, in 8.3.x I see that using the web interface to export any dashboard with “Export for sharing externally” set to true generates only the following JSON:{“error”:{}}. This is certainly a separate issue.
Best regards,

HTTP API for dashboard export for external use doesn’t exist. This export feature is implemented in the UI (frontend). I would say the only option is to use standard dashboard API and make that output transformed into “dashboard format for external use”. Unfortunately, that format is not documented, so you have to use reverse engineering.

Hi Jan!
I think the HTTP API is the same as the standard dashboard api, or at least we’re both linking to the same page. I don’t see how the datasource information is available from the API. By “use reverse engineering”, are you suggesting a selenium-like script, or something better that I’m missing?

You can read the source code. You can export dashboard via API and then via UI (with external use) - then compare results and write transformations, …

1 Like

Hi again,

Oh, I see. I believe I never saw that format before, thank you! On this matter, I should have followed your original references.

While I have nothing significant to contribute now, I still want to reference the corresponding place in the code base, where this JSON representation is generated. It is DashboardExporter.ts.

Also, I created a note at https://github.com/panodata/grafana-client/issues/8 about this. I will be happy to hear your opinions about it.

With kind regards,


Thanks very much! This takes us a big step closer to a solution.
Just to confirm what I think you and @jangaraj are saying: DashboardExporter takes a DashboardModel which is constructed based solely on the output of the http api. Is this correct?

still no api to export dashboard externally ?

Just for the records. We started with an implementation but haven’t been able to complete it, yet.

Contributions from people who love to mangle nested data structures and know Grafana and Python will be very much appreciated on this.

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.