# Changing/removing API rate limit with category creation

**URL:** https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611
**Category:** Development
**Tags:** rest-api
**Created:** [January 22, 2018, 12:51am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611 "2018-01-22T00:51:05Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 12:51am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/1 "2018-01-22T00:51:05Z")

</div>

I’ve been running into an issue with _creating categories_ via the API. It seems there is a limit, but that limit doesn’t seem to be customizable nor does it seem to have a setting to disable it anywhere.

The error I get is: `We have a daily limit on how many times that action can be taken. Please wait 17 seconds before trying again.`

The amount of seconds seems to always be under 20 seconds, but never accurate as it states that it is a daily limit and I’ve tried within a minute of the last attempt. I’ve also tried adjusting _ALL_ rate limits under the admin dashboard to 1000+, but none of them seem to affect category creation.

The only available rate limits on the dashboard: max topics, private messages, likes, bookmarks, flags, edits, invites, topic invitations, topics, prints, and logins.

I’m using the [GitHub - discourse/discourse\_api: Ruby API for Discourse · GitHub](https://github.com/discourse/discourse_api) for it, which worked fine until the unspecified rate limit was hit.

Am I missing something? This isn’t coming from nginx either, as the message is from Discourse and the rate limiting template for nginx has been disabled.

---

<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 22, 2018, 1:25am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/2 "2018-01-22T01:25:50Z")

</div>

See:

> [@Available settings for global rate limits and throttling](https://meta.discourse.org/t/global-rate-limits-in-discourse/78612):
>
> Discourse ships with 3 different global rate limits that can be configured by site admins. Global per-ip rate limits These limits apply to every unique IP address that hits the Discourse application. (files that are served directly from the filesystem or the CDN are excluded) By default this rate limit is enabled, you may disable it or set it to a reporting mode. DISCOURSE\_MAX\_REQS\_PER\_IP\_MODE : default block, this rate limit applies out of the box. (other options are warn, warn+block, and n…

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:27am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/3 "2018-01-22T01:27:03Z")

</div>

Thanks @sam, not sure how I missed that!

---

<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 22, 2018, 1:29am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/4 "2018-01-22T01:29:39Z")

</div>

No worries, I have meant to make that post for a while @mpalmer asked for it a few weeks ago ;p

[@community](https://meta.discourse.org/groups/community) FYI ^^^

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:31am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/5 "2018-01-22T01:31:43Z")

</div>

Ahh, it’s new, didn’t notice that either. Not on top of it today I guess…

I’m only performing one request though to create a category and don’t see any daily limits there. Is there another limit that would be attributing to the 429 error?

---

<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 22, 2018, 1:35am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/6 "2018-01-22T01:35:07Z")

</div>

Well first thing I would try is another API endpoint to see if this is the global rate limit or some specific rate limit on category creation (or maybe a user rate limit in the app), be sure your api\_username is an admin

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:35am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/7 "2018-01-22T01:35:49Z")

</div>

Using ‘system’ and the key was generated via the admin dashboard. It don’t have an issue grabbing the category list, only creating a category.

---

<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 22, 2018, 1:37am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/8 "2018-01-22T01:37:28Z")

</div>

Not seeing anything particular in the app, I would try a different admin user to see what happens, maybe the error you are getting is a different limit.

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:44am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/9 "2018-01-22T01:44:04Z")

</div>

Tried another user and a generic key for all users, but both hit the same 429 error and limit when trying to create a category.

---

<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 22, 2018, 1:45am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/10 "2018-01-22T01:45:28Z")

</div>

Is there anything in the response body you are receiving?

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:47am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/11 "2018-01-22T01:47:01Z")

</div>

Just the error message:

```plaintext
 {"errors"=>["We have a daily limit on how many times that action can be taken. Please wait 21 seconds before trying again."], "error_type"=>"rate_limit"} (DiscourseApi::TooManyRequests)

```

---

<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 22, 2018, 1:48am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/12 "2018-01-22T01:48:38Z")

</div>

Are you 100% sure nothing is stuck in some sort of a loop hitting the server?

Also are you running latest version of Discourse?

Does it come back with 21 seconds every time?

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 1:51am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/13 "2018-01-22T01:51:49Z")

</div>

Running 2.0.0.beta1. Not aware of anything looping, only I have access to these keys and the script that runs them is ran manually by me as I’m developing something to automate creating categories. I have 1 call to get the existing category lists, then one call per category creation (only 1 category right now). It has worked to create most of the categories before the rate limit got hit.

The ‘seconds’ varies; often 12, 17, 21, or other amount around that amount.

---

<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 22, 2018, 1:53am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/14 "2018-01-22T01:53:56Z")

</div>

What happens if you disable the global admin api rate limit (raise it to say 500 a minute and 500 per ten seconds)? Does this go away?

I would guess that something about your script is pummeling too many requests at the server.

---

<div class="post-metadata">

### Author: ![lukespragg](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@lukespragg](https://meta.discourse.org/u/lukespragg)
#### Post date: [January 22, 2018, 2:15am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/15 "2018-01-22T02:15:27Z")

</div>

Yup… you appear to have been right! A variable wasn’t being set when it needed to be, so it was bypassing a check I had. Seems to be working fine now, no hammering the API anymore. Still good to know the info you posted though, so I appreciate that.

---

<div class="post-metadata">

### Author: ![erohmensing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erohmensing/32/149116_2.png) [@erohmensing](https://meta.discourse.org/u/erohmensing)
#### Post date: [July 30, 2019, 9:18am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/16 "2019-07-30T09:18:53Z")

</div>

Hey @sam, could you point me to where I can disable the global admin api limit? I have a script to pull response times that requires getting all the topics in a timeframe and then for each topic, getting all of the posts for the topic, and I keep running into the rate limiting (`You’ve performed this action too many times. Please wait 6 seconds before trying again.'`).

Apologies if this old thread i dug up is now really out of date 😃

---

<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: [July 31, 2019, 4:31am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/17 "2019-07-31T04:31:29Z")

</div>

Are you 100% sure it is not covered in:

> [@Available settings for global rate limits and throttling](https://meta.discourse.org/t/global-rate-limits-and-throttling-in-discourse/78612):
>
> Discourse ships with 3 different global rate limits that can be configured by site admins. Global per-ip rate limits These limits apply to every unique IP address that hits the Discourse application. (files that are served directly from the filesystem or the CDN are excluded) By default this rate limit is enabled, you may disable it or set it to a reporting mode. DISCOURSE\_MAX\_REQS\_PER\_IP\_MODE : default block, this rate limit applies out of the box. (other options are warn, warn+block, and n…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [August 19, 2023, 11:34am UTC](https://meta.discourse.org/t/changing-removing-api-rate-limit-with-category-creation/78611/18 "2023-08-19T11:34:35Z")

</div>


