# Kibana API to Query Dashboard or Visualisation Metadata

**URL:** https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326
**Category:** Elastic Observability
**Tags:** dashboard
**Created:** [March 24, 2025, 12:24pm UTC](https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326 "2025-03-24T12:24:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![console\_fulcrum](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/console_fulcrum/32/142169_2.png) [@console\_fulcrum](https://discuss.elastic.co/u/console_fulcrum)
#### Post date: [March 24, 2025, 12:24pm UTC](https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326/1 "2025-03-24T12:24:12Z")

</div>

ELK Stack Version 8.17.2

**Problem -**  
Too many unused dashboards, visualisations - that need to be identified and removed (criteria - 0 views in 90 days, last updated \< 1 year)

**For a given Kibana API Query -**  
/api/dashboards/dashboard or /api/dashboards/dashboard/{id}

**Question**

- How do I get the same stats , that is shown to me when I click on ? marker against a dashboard name?  
I want specifically - to fetch via API the following -
- Name,
- Tags,
- Description,
- Created By,
- Last Updated By,
- Views ( in last 90 days)

I was able to view this via inspect element , but how do I do this via API?  
I cannot see this data, when i used?

Let me know for any endpoints , that might be hidden (or) - relatively unknown.

Appreciate any help I can get.  
Thanks!

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [March 25, 2025, 7:25am UTC](https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326/2 "2025-03-25T07:25:03Z")

</div>

Hello,

The API used is an internal one: `kbn:/internal/content_management/insights/dashboard/{id}/viewed/stats`

The bad news is that internal APIs will be restricted starting with [Elastic 9.0](https://github.com/elastic/kibana/issues/163654), so this is not the way to go.

Name and description are in the Dashboard API, so they are easy.

To get the tags, you need to read the dashboard and then find the tag references. Those can then be resolved using the saved-object API:

```auto
GET kbn:/api/saved_objects/tag/{tag-id}

```

To get the usage, this may help you:

```auto
POST .kibana_usage_counters*/_search?size=1000
{
    "query": {
        "bool": {
            "must": [
              {
                "term": {
                  "usage-counter.counterName": {
                    "value": "{id}"
                  }
                }
              }
            ]
        }
    }
}

```

Created By, Updated By are an issue again as they require access to the internal API (blocked with 9.0 again). Read the IDs of the Users from the dashboard API and look them up from the user profiles:

```auto
POST kbn:/internal/security/user_profile/_bulk_get
{"uids":["u_jWVHFUVDB9fLX46n2HvF1-6BhFs1Wlx1Ew0ZNIARFCM_1"]}

```

I am sorry to say that I have no idea how to workoaround the issues for created/updated by. Still I hope this helps you to get started.

Best regards  
Wolfram

---

<div class="post-metadata">

### Author: ![console\_fulcrum](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/console_fulcrum/32/142169_2.png) [@console\_fulcrum](https://discuss.elastic.co/u/console_fulcrum)
#### Post date: [March 25, 2025, 11:24am UTC](https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326/3 "2025-03-25T11:24:00Z")

</div>

Hi @Wolfram_Haussig -

Thanks for the lead! - Yes initially we had a hint that this most likely is an internal API , you confirmed it.

You see what we're trying to achieve is something like this

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/5/a542256472f7a6a0b87cf671af78f95fcff121d0.jpeg)

but I do not know , what was queried - to arrive at this dashboard, we want to consume the same, but via APIs?

(I understand, the only way to do this right now might be via internal APIs, which is further being restricted from 9.0)

However, we're looking at a 1 time activity - of carrying out the cleanup task, so we will use the /internal/content-management endpoint .

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [March 25, 2025, 1:55pm UTC](https://discuss.elastic.co/t/kibana-api-to-query-dashboard-or-visualisation-metadata/376326/4 "2025-03-25T13:55:59Z")

</div>

Maybe this query helps you:

```auto
POST .kibana_usage_counters*/_search?size=1000
{
    "query": {
        "bool": {
            "must": [
              {
                "term": {
                  "usage-counter.counterType": {
                    "value": "viewed"
                  }
                }
              },
              {
                "range": {
                  "updated_at": {
                    "gte": "now-30d"
                  }
                }
              }
            ]
        }
    },
    "aggs": {
      "usage": {
        "terms": {
          "field": "usage-counter.counterName"
        },
        "aggs": {
          "count": {
            "sum": {
              "field": "usage-counter.count"
            }
          }
        }
      }
    }
}

```

It reads the usage of the objects and aggregates them to show the total view count for the last 30 days.
