# Categories.json API not returning Lounge and Staff categories

**URL:** https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391
**Category:** Support
**Created:** [October 12, 2018, 5:13pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391 "2018-10-12T17:13:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![alldritt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alldritt/32/119516_2.png) [@alldritt](https://meta.discourse.org/u/alldritt)
#### Post date: [October 12, 2018, 5:13pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/1 "2018-10-12T17:13:12Z")

</div>

I’m trying to use the categories.json API end point to obtain the categories in my forum. I returns all the top level categories except for Lounge and Staff. My account has access to these categories.

I’m GETing `https://discourse.example.com/categories.json?api_key=myAPIKEY&api_username=myusername`

Is this just how it works, or do I need to specify additional information to get all the categories my Discourse account has access to?

I’m running: v2.2.0.beta2 +115

---

<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: [October 12, 2018, 5:34pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/2 "2018-10-12T17:34:58Z")

</div>

You should be able to get the Staff and Lounge categories from `/categories.json`. Make sure the user whose API key you are using has permission to view the Staff and Lounge categories.

---

<div class="post-metadata">

### Author: ![alldritt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alldritt/32/119516_2.png) [@alldritt](https://meta.discourse.org/u/alldritt)
#### Post date: [October 12, 2018, 5:46pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/3 "2018-10-12T17:46:54Z")

</div>

Thanks for the response. I’m using my username for the API calls and I’m the site admin. I have access to these categories when I use my site interactively.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 12, 2018, 7:37pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/4 "2018-10-12T19:37:51Z")

</div>

Without using the api can you just browse to this page as a logged in user

`https://discourse.example.com/categories`

and see Staff and Lounge? I assume so since

> [@alldritt](#):
>
> I have access to these categories when I use my site interactively.

Do they still show up if you visit the .json version from a web browser?

`https://discourse.example.com/categories.json`

So far I’m unable to replicate your behaviour.

If you do:

```
curl -I https://discourse.example.com/c/staff.json

```

do you get a `404` response?

Try the same call with your api key/username

```
curl -I https://discourse.example.com/c/staff.json?api_key=myAPIKEY&api_username=myusername

```

Do you get still get a 404?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [October 12, 2018, 8:20pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/5 "2018-10-12T20:20:54Z")

</div>

Ohh I see you are trying to do this from iOS Shortcuts:

> [@Posting to a Discourse forum from iOS Shortcuts](https://meta.discourse.org/t/posting-to-a-discourse-forum-from-ios-shortcuts/99394):
>
> This post describes how to post new topics to a Discourse forum using the new iOS Shortcuts app.

I think the problem might be that you have put the api\_key and api\_username in the Headers field.

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/f/9f91cd0496691d2a6073d52d9f77c4797c075d41.jpeg)

We don’t read normal api\_keys and api\_username out of the headers field, so I think your request is showing up as a non-authenticated user.

Are you able to put the api\_key and api\_username in the URL field?

---

<div class="post-metadata">

### Author: ![alldritt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alldritt/32/119516_2.png) [@alldritt](https://meta.discourse.org/u/alldritt)
#### Post date: [October 12, 2018, 9:18pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/6 "2018-10-12T21:18:55Z")

</div>

> [@blake](#):
>
> I think the problem might be that you have put the api\_key and api\_username in the Headers field

Thanks, good spotting. I have some AppleScript code that generates the GET URL correctly and that returns all the categories.

---

<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 11, 2018, 9:22pm UTC](https://meta.discourse.org/t/categories-json-api-not-returning-lounge-and-staff-categories/99391/7 "2018-11-11T21:22:13Z")

</div>

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