# How to get a category name with the ID via API

**URL:** <https://meta.discourse.org/t/how-to-get-a-category-name-with-the-id-via-api/65926>\
**Category:** Development\
**Created:** [10 juli 2017 om 08:48 UTC](https://meta.discourse.org/t/how-to-get-a-category-name-with-the-id-via-api/65926 "2017-07-10T08:48:03Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [17 maart 2020 om 00:14 UTC](https://meta.discourse.org/t/how-to-get-a-category-name-with-the-id-via-api/65926/9 "2020-03-17T00:14:27Z")

</div>

Making an API request to `site.json` is the correct way to get a list of categories that includes subcategories. Also, if you want private categories to be returned by the request to `site.json`, you need to make an authenticated API request.

> [@nedbat](#):
>
> I was scouring the docs looking for a way to get the names of subcategories and couldn’t find it.

I’m not seeing any reference to `site.json` in the docs. SInce `categories.json` doesn’t return subcategories, the description of the `categories` route in the docs isn’t correct, it says that the route returns _all_ categories. I will fix that.

---

_[View the full topic](https://meta.discourse.org/t/how-to-get-a-category-name-with-the-id-via-api/65926)._
