# 500 Errors on Rate Limit When Using the Admin API Via Keys

**URL:** https://meta.discourse.org/t/500-errors-on-rate-limit-when-using-the-admin-api-via-keys/77779
**Category:** Support
**Created:** [January 11, 2018, 7:46pm UTC](https://meta.discourse.org/t/500-errors-on-rate-limit-when-using-the-admin-api-via-keys/77779 "2018-01-11T19:46:11Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 12, 2018, 3:28am UTC](https://meta.discourse.org/t/500-errors-on-rate-limit-when-using-the-admin-api-via-keys/77779/7 "2018-01-12T03:28:34Z")

</div>

OK this is fixed per:

> [@We should never leak out exceptions in our controller tests](https://meta.discourse.org/t/we-should-never-leak-out-exceptions-in-our-controller-tests/77800):
>
> I just finished pushing a rather gnarly change per: It basically replaces this pattern we used previously in tests: expect do get :index, format: :json end.to raise\_error(Discourse::NotLoggedIn) With this get :index, format: :json expect(response.status).to eq(403) I made this change so our test environment is much more inline with our production environment. Previously we were leaking out a few exceptions and erroneously returning 500 status when we had a far more appropriate status…

But it will take a bit for it to land cause I need to clean plugin tests.

The particular reason you are getting rate limited is:

> <https://github.com/discourse/discourse/blob/main/config/discourse_defaults.conf#L177>

if you are self hosting you can raise `DISCOURSE_MAX_ADMIN_API_REQS_PER_KEY_PER_MINUTE` to a higher number. We introduced this limit to protect from unintentional API abuse.

---

_[View the full topic](https://meta.discourse.org/t/500-errors-on-rate-limit-when-using-the-admin-api-via-keys/77779)._
