# Tag ids in API response

**URL:** <https://meta.discourse.org/t/tag-ids-in-api-response/119106>\
**Category:** Support\
**Created:** [May 30, 2019, 5:37pm UTC](https://meta.discourse.org/t/tag-ids-in-api-response/119106 "2019-05-30T17:37:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimJensen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/timjensen/32/543315_2.png) [@TimJensen](https://meta.discourse.org/u/TimJensen)\
**Post date:** [May 30, 2019, 5:37pm UTC](https://meta.discourse.org/t/tag-ids-in-api-response/119106/1 "2019-05-30T17:37:55Z")

</div>

The /tags.json endpoint is returning tag names as tag ids. For example:

```plaintext
{
    "tags": [
        {
            "id": "suspensions",
            "text": "suspensions",
            "count": 0,
            "pm_count": 0
        }
    ]
}

```

I would have expected the id field to match the tag’s id in the database. Is this a bug or am I thinking about it wrong?

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [May 30, 2019, 9:40pm UTC](https://meta.discourse.org/t/tag-ids-in-api-response/119106/2 "2019-05-30T21:40:47Z")

</div>

It isn’t a bug, because the API is returning the data that is required for creating the tags page. I was surprised to see the `name` returned for the `id` as well, but it is set explicitly in the code.

If you need to get a tag’s id, you can get it from the `/tags/<tag-name>.json` end point. What action are you performing that you need the tag id for?

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [November 22, 2022, 11:29pm UTC](https://meta.discourse.org/t/tag-ids-in-api-response/119106/4 "2022-11-22T23:29:58Z")

</div>

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