# How to find a tag using the plugin-api

**URL:** https://meta.discourse.org/t/how-to-find-a-tag-using-the-plugin-api/238209
**Category:** Development
**Tags:** plugin-api
**Created:** [September 6, 2022, 8:29am UTC](https://meta.discourse.org/t/how-to-find-a-tag-using-the-plugin-api/238209 "2022-09-06T08:29:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [September 6, 2022, 8:29am UTC](https://meta.discourse.org/t/how-to-find-a-tag-using-the-plugin-api/238209/1 "2022-09-06T08:29:20Z")

</div>

I have the following import statement in my code (javascript side):

```plaintext
import Tag from "discourse/models/tag";

```

However, I can’t use it to retrieve a tag object by it’s name. My goal is to obtain the tag description, but I only have the name. I was expecting something similar to this:

```plaintext
const tagObj = Tag.find("tag_name");
const tagDesc = tagObj.description;

```

Does the Tag model have a similar function?

---

<div class="post-metadata">

### Author: ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)
#### Post date: [September 13, 2022, 10:36pm UTC](https://meta.discourse.org/t/how-to-find-a-tag-using-the-plugin-api/238209/2 "2022-09-13T22:36:46Z")

</div>

You can fetch tag data from the `/tags.json` endpoint.

In this example I’m getting an `email` tag’s description:

```js
import { ajax } from "discourse/lib/ajax";

```

```js
  ajax(`/tags.json`).then(({ tags }) => {
    const emailTag = tags.find((tag) => tag.name === "email");
    const emailTagDesc = emailTag.description;
  });

```

---

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [September 17, 2022, 10:04am UTC](https://meta.discourse.org/t/how-to-find-a-tag-using-the-plugin-api/238209/3 "2022-09-17T10:04:13Z")

</div>

Thanks! I guess I found a more efficient way to accomplish this:

```javascript
this.store.find("tag-info", "email").then(data => { 
 const tag_desc = data.description
});

```

However, I don’t know if `this.store.find` is faster than sending an ajax query to all tags and filtering. Maybe it’s doing the same thing.
