Rate limit with App Access Token

Hello, documentation is talking about https://dev.twitch.tv/docs/api/guide/#rate-limits :

  • Bearer token is provided: 800 points per minute, per user
  • Bearer token is not provided: 30 points per minute

When requesting API, the remainig rate limit (provided by response) never seems to go below 750. Even with “spamming” requests.

Maybe it’s not about minute but about seconds when Baerer token is provided.

In our app we are trying to apply some cache if this rate limiting is about 800 per minute but not if it’s about 800 per seconds.

Thanks !

1 Like

If you follow the link in the docs it explains a bit about how the rate limit is calculated https://en.wikipedia.org/wiki/Token_bucket

Basically, with the old rate limit system each request would use 1 of your rate limit, and ~1 minute later it’d go up again. So if you were to use your max rate limit over a minute, you would go from your max down to 0 and then start to ‘regain’ at the same rate you’re using them so would stay around 0.

The way it works in the new system, you’re constantly regaining rate limit (up to your max). So the 800 default bearer token limit allows for 13.333… requests per second. If you use exactly that limit you’ll hover around 800 as you’re using them the same rate your getting them. If you use more, the rate-limit-remaining will decrease, and if you use less than 13.333… you’ll go back up until you reach 800.

TL;DR - It is correctly 800/min, but because of the way you regain your rate limit now if you request the same amount as your limit you’ll be hovering around 800 limit remaining still, and only dip lower as you use beyond your limit. This allows you to more easily ‘burst’ requests for short period, which could have previously caused you to exceed your rate limit.


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