# Rate Limit being hit suddenly

**URL:** <https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948>\
**Category:** API\
**Created:** [April 15, 2022, 10:13pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948 "2022-04-15T22:13:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Azazael13](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Azazael13](https://discuss.dev.twitch.com/u/Azazael13)\
**Post date:** [April 15, 2022, 10:13pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/1 "2022-04-15T22:13:21Z")

</div>

I am using the following endpoint [https://id.twitch.tv/oauth2/token](https://id.twitch.tv/oauth2/token) and sending in the required params (grant\_type, refresh\_token, client\_id, and client\_secret). Over the last few weeks I have noticed I have been getting a large amount of rate limit exceeded results. I have never had this issue on this endpoint before, did something change? There isn’t a different one that uses the bearer token with a higher rate limit is there?

Thanks

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 15, 2022, 10:15pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/2 "2022-04-15T22:15:06Z")

</div>

Check the repsonse headers on the HTTP request to see the current limits and remaining.

> [@Azazael13](#):
>
> I have never had this issue on this endpoint before, did something change?

No

> [@Azazael13](#):
>
> There isn’t a different one that uses the bearer token with a higher rate limit is there?

No

> [@Azazael13](#):
>
> have never had this issue on this endpoint before

Which endpoint are you having issues with?

---

<div class="post-metadata">

**Author:** ![Azazael13](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Azazael13](https://discuss.dev.twitch.com/u/Azazael13)\
**Post date:** [April 15, 2022, 10:27pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/3 "2022-04-15T22:27:26Z")

</div>

The one to refresh twitch user access tokens, via their refresh token. I just added some code to my bot to get the headers, but it seemed odd that I just started having this issue recently.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 15, 2022, 10:29pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/4 "2022-04-15T22:29:22Z")

</div>

To my knowledge that endpoint shouldn’t/deosnt’ have rate limiting.

So check the

- HTTP code
- the actual response message
- headers

Also note you only need to refresh a user token when you need to use a token, so auto refreshing it on the four hourly~ish schedule might be overkill.

But I suppose it does depend how many user tokens your service is trying to refresh, it should onlty have the broadcasters token for sub read/channel update/etc.

---

<div class="post-metadata">

**Author:** ![Azazael13](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Azazael13](https://discuss.dev.twitch.com/u/Azazael13)\
**Post date:** [April 15, 2022, 10:34pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/5 "2022-04-15T22:34:12Z")

</div>

The response status is 429 which is their rate limit exceeded status. I can reply again when I get another failure, but I was also under the impression that this endpoint shouldn’t be behaving like this. I am only worried about the broadcaster tokens, and I have never had this issue in the past refreshing them every 220 minutes. This is something that just recently started happening (and I hadn’t made any code changes). I have under 100 active users right now, so there is no way I should be hitting the 800 limit that exists for other endpoints.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 15, 2022, 10:36pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/6 "2022-04-15T22:36:31Z")

</div>

That does seem weird.

that might be indicative of some other code you have running amok somewhere else and the system is self protecting. Since first report.

So wise to check you have no other processes doing weird stuff.

---

<div class="post-metadata">

**Author:** ![Azazael13](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Azazael13](https://discuss.dev.twitch.com/u/Azazael13)\
**Post date:** [April 15, 2022, 10:39pm UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/7 "2022-04-15T22:39:25Z")

</div>

I hadn’t made any changes for almost 2 months when this just started 🙂 . Either way when I get more header information I will report back.

---

<div class="post-metadata">

**Author:** ![Azazael13](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@Azazael13](https://discuss.dev.twitch.com/u/Azazael13)\
**Post date:** [April 19, 2022, 12:54am UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/8 "2022-04-19T00:54:30Z")

</div>

Some more information:  
As I said the response code is 429.  
The response message is empty (length of 0)  
There are no twitch specific headers (limit, remaining, etc).

I am hitting the limit even when no other calls are going out, so I am not really sure what has changed, unless I am sending them out too quickly and something on twitches end is wanting me to slow down (that is the next change I am going to implement).

Other ideas?

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [May 19, 2022, 12:55am UTC](https://discuss.dev.twitch.com/t/rate-limit-being-hit-suddenly/37948/9 "2022-05-19T00:55:05Z")

</div>

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