# Discourse\_api gem help

**URL:** https://meta.discourse.org/t/discourse-api-gem-help/60957
**Category:** Support
**Created:** [April 14, 2017, 1:27am UTC](https://meta.discourse.org/t/discourse-api-gem-help/60957 "2017-04-14T01:27:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chris\_j](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chris\_j](https://meta.discourse.org/u/chris_j)
#### Post date: [April 14, 2017, 1:27am UTC](https://meta.discourse.org/t/discourse-api-gem-help/60957/1 "2017-04-14T01:27:33Z")

</div>

Hello all!

We’re using discourse for our user community, and the discourse\_api ruby gem to pull latest and top topics for our site (using the category\_latest\_topics and category\_top\_topics methods)

However, we are having topics shown that are from (sub?) categories that have their security set so that only admins may view them.

I would assume this is because our api key has admin privileges… is there any way for us to exclude topics based on this security setting?

Thanks!  
Chris

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [April 14, 2017, 3:12am UTC](https://meta.discourse.org/t/discourse-api-gem-help/60957/2 "2017-04-14T03:12:46Z")

</div>

I’m not familiar with the gem…

… but my understanding is that for the Discourse API generally an “API Key” is coupled with a “Username” - all the actions take place as that username…  
… so if you specify “`system`” these actions take place as an admin as in the default setup “`system`” is an admin.

If you change the username to the name of a user with limited permissions the actions will take place with those limited permissions and return the restricted results you are after.

---

<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: [May 25, 2019, 8:15am UTC](https://meta.discourse.org/t/discourse-api-gem-help/60957/3 "2019-05-25T08:15:57Z")

</div>



---

<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: [June 24, 2019, 8:16am UTC](https://meta.discourse.org/t/discourse-api-gem-help/60957/4 "2019-06-24T08:16:00Z")

</div>

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