# Find all the saved objects for a given tag

**URL:** https://discuss.elastic.co/t/find-all-the-saved-objects-for-a-given-tag/298486
**Category:** Kibana
**Created:** [March 1, 2022, 9:19am UTC](https://discuss.elastic.co/t/find-all-the-saved-objects-for-a-given-tag/298486 "2022-03-01T09:19:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)
#### Post date: [March 1, 2022, 9:19am UTC](https://discuss.elastic.co/t/find-all-the-saved-objects-for-a-given-tag/298486/1 "2022-03-01T09:19:00Z")

</div>

Hello,

I try to call a REST request to get all the saved objects tagged with a given tag `FS`. I'd like to call something like

`GET api/kibana/management/saved_objects/_find?type=dashboard&search_fields=tag&search=FS`

It does not returns anything, even if this one returns a dashboard, which is tagged with `FS`

`api/saved_objects/_find?type=dashboard&search_fields=title&search=RUNS`

There are some examples where you can use this parameter to the URL `&hasReference=%5B%7B%22type%22%3A%22tag%22%2C%22id%22%3A%2233c9ecf0-9880-11ec-9ed3-9f11b117f7f7%22%7D%5D`

which is more complicated as it requires to use the ID of the tag, it means a pre request...

thank's

---

<div class="post-metadata">

### Author: ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)
#### Post date: [March 7, 2022, 6:47pm UTC](https://discuss.elastic.co/t/find-all-the-saved-objects-for-a-given-tag/298486/2 "2022-03-07T18:47:38Z")

</div>

I don't think there is a way to search for tag objects based on its name. As you already saw, and per [documentation](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html), you need to use the `has_reference` parameter with the (encoded) payload:

```json
[
  {
    "type":"tag",
    "id":"tag-long-identifier"
  }
]

```

So to check the API I added the `test1` tag to a few objects in a clean instance with sample data:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/4/d468d66bf1547e2e3e4841e2c3d2f03315518ffb.png)

First to get the `test1` identifier search filtering for its name:

```auto
TAG_ID=$(curl --silent "http://localhost:5603/api/saved_objects/_find?type=tag&search=test1" | jq -r ".saved_objects[].id")

```

Put all saved object types in a variable to make the final command a bit easier to read:

```auto
TYPES_PARAMS="type=config&type=url&type=index-pattern&type=query&type=tag&type=action&type=alert&type=graph-workspace&type=visualization&type=canvas-element&type=canvas-workpad&type=dashboard&type=map&type=lens&type=cases&type=search&type=osquery-saved-query&type=osquery-pack&type=uptime-dynamic-settings&type=infrastructure-ui-source&type=metrics-explorer-view&type=inventory-view&type=apm-indices"

```

Now you can use use both variables in a final request:

```auto
$ curl --silent "http://localhost:5603/api/saved_objects/_find?${TYPES_PARAMS}&has_reference=%5B%7B%22type%22%3A%22tag%22%2C%22id%22%3A%22${TAG_ID}%22%7D%5D" | \
  jq -c ".saved_objects[].attributes.title"
"Test lens"
"[Flights] Delays & Cancellations"
"[Flights] Delay Buckets"

```

---

<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: [April 4, 2022, 6:47pm UTC](https://discuss.elastic.co/t/find-all-the-saved-objects-for-a-given-tag/298486/3 "2022-04-04T18:47:50Z")

</div>

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