Why am I blocked from using the discord api?

15,274

Exceeding the rate limit means that the discord API is explicitly telling you that you cannot read any more data from their API for a given amount of time.

Looking at their rate limit docs, the rate limit varies depending on the endpoint you're talking to:

The HTTP API implements a process for limiting and preventing excessive requests in accordance with RFC 6585. API users that regularly hit and ignore rate limits will have their API keys revoked, and be blocked from the platform. For more information on rate limiting of requests, please see the Rate Limits section.

To help, they conveniently return some information on where you stand with respect to their rate limiting:

X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1470173023
X-RateLimit-Bucket: abcd1234
...

If you're using the requests library you can easily check if you're close to exceeding the rate limit:

req = requests.get("https://discord.com/api/path/to/the/endpoint")

req.headers["X-RateLimit-Remaining"] # How many more requests you can make before `X-RateLimitReset`

Share:
15,274
Admin
Author by

Admin

Updated on June 20, 2022

Comments

  • Admin
    Admin almost 2 years

    Im coding a discord bot and I got this error randomly. From what I can interpret, I am temporarily blocked from discord.py api, but what does the "exceeding rate limits part mean?"

    discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.

  • jvriesem
    jvriesem over 2 years
    Could you show the requests stuff in a MWE?