# How to get ids for dashboard

**URL:** https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726
**Category:** Kibana
**Created:** [May 1, 2020, 3:09pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726 "2020-05-01T15:09:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [May 1, 2020, 3:09pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/1 "2020-05-01T15:09:58Z")

</div>

is there a curl command that I can run and get dashboard IDs?  
or is there endpoint define which has this information?

I am trying to create a script which does dashboard/viz export in loop.

I have figure out how to do this if I know ids of all dashboards.

---

<div class="post-metadata">

### Author: ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)
#### Post date: [May 1, 2020, 3:34pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/2 "2020-05-01T15:34:33Z")

</div>

Hello @elasticforme

First you can search for Dashboards using the [Find API on Kibana](https://www.elastic.co/guide/en/kibana/current/saved-objects-api-find.html).

Then you can Export the Dashboard using the [Export Dashboard API on Kibana](https://www.elastic.co/guide/en/kibana/current/dashboard-api-export.html).

Please consider those APIs are subject to change.

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [May 1, 2020, 4:05pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/3 "2020-05-01T16:05:23Z")

</div>

@Luca_Belluccini

That I know, I want to automate this process because I have 10+ space and each has five-six dashboards and three different clusters  
means 150 dashboards.

Following command works from bash script and I jsut have to get all the ids for all dashboard. because in my cluster user has access to create what they want and any given day user might create new dashboard. I would like to get that backed up automatically.

```
curl -u ${elastic_user} -X POST "${URL}${space_name}" -H "kbn-xsrf: true" -H "Content-Type: application/json" -d"
{ \"objects\":[
   {
      \"type\":\"dashboard\",
      \"id\":\"xyxyxyxyxyxyx"
   } ] ,
   \"includeReferencesDeep\": true
}"
```

---

<div class="post-metadata">

### Author: ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)
#### Post date: [May 1, 2020, 5:37pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/4 "2020-05-01T17:37:04Z")

</div>

The documentation specified the `curl` commands.

You will need a tool like [`jq`](https://stedolan.github.io/jq/) to manipulate JSON responses and iterate through them.

The best way to backup dashboards is to use the [Snapshot/Restore](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshot-restore.html#snapshot-restore) capabilities of Elasticsearch, just snapshotting all the indices named prefixed `.kibana*`.

Something like this will search all the dashboards and generate one file per dashboard.

If you have multiple spaces, you'll need to do another external loop to search for spaces and insert the space id in the URL.

```auto
curl -s -k -X GET "${kibanaurl}/api/saved_object/_find?fields=id&type=dashboard&per_page=1000" -u ${user}:${password} | jq '.saved_objects[].id' | xargs -n1 -I{} curl -s -k -X GET "${kibanaurl}/api/kibana/dashboards/export?dashboard={}" -u ${user}:${password} -o {}.json

```

---

<div class="post-metadata">

### Author: ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)
#### Post date: [May 4, 2020, 1:01pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/5 "2020-05-04T13:01:11Z")

</div>

> [@Luca\_Belluccini](#):
>
> curl -s -k -X GET "${kibanaurl}/api/saved\_object/\_find?fields=id&type=dashboard&per\_page=1000" -u ${user}:${password} | jq '.saved\_objects.id' | xargs -n1 -I{} curl -s -k -X GET "${kibanaurl}/api/kibana/dashboards/export?dashboard={}" -u ${user}:${password} -o {}.json

actually can't find this on new version.  
I am running 7.6.2

curl -s -k -u user:password -X GET "[http://elkm01:5601/api/saved\_object/\_find?fields=id&type=dashboard&per\_page=1000](http://elkm01:5601/api/saved_object/_find?fields=id&type=dashboard&per_page=1000)"

{"statusCode":404,"error":"Not Found","message":"Not Found"}

Reason I want to save seperate dashboard is because if someone mess up his/her own dashboard I can restore that one. by just backing up whole .kibana\* indexes I can't do that.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 1, 2020, 1:01pm UTC](https://discuss.elastic.co/t/how-to-get-ids-for-dashboard/230726/6 "2020-06-01T13:01:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
