# 404 Error returned when using DiscourseAPI Gem to Generate User API Key

**URL:** <https://meta.discourse.org/t/404-error-returned-when-using-discourseapi-gem-to-generate-user-api-key/140892>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [February 6, 2020, 5:04pm UTC](https://meta.discourse.org/t/404-error-returned-when-using-discourseapi-gem-to-generate-user-api-key/140892 "2020-02-06T17:04:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Anthony\_Dirago](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anthony_dirago/32/137283_2.png) [@Anthony\_Dirago](https://meta.discourse.org/u/Anthony_Dirago)\
**Post date:** [February 7, 2020, 3:30pm UTC](https://meta.discourse.org/t/404-error-returned-when-using-discourseapi-gem-to-generate-user-api-key/140892/3 "2020-02-07T15:30:14Z")

</div>

Thank you!

I updated my code to use the “All Users” key instead of generating one for each user and pass the user’s username as the api\_username and that fixed it.

---

_[View the full topic](https://meta.discourse.org/t/404-error-returned-when-using-discourseapi-gem-to-generate-user-api-key/140892)._
