Tag ids in API response

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

{
    "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?

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?

2 Likes