tether developers
Contents

Docs

Rate limits

Discord's headers and 429 body, tether's own buckets, and the 50-a-second limit for bots.

Every answer from a rate limited route carries Discord's headers, and a 429 carries the rest, so discord.py and discord.js queue their own requests instead of running into the limit. Do not hard-code the numbers below: read the headers.

Header Meaning
X-RateLimit-Limit How many requests the bucket allows in its window.
X-RateLimit-Remaining How many are left. At 0 a library waits for the reset.
X-RateLimit-Reset When the window ends, in seconds since the epoch (with decimals).
X-RateLimit-Reset-After Seconds until then (with decimals).
X-RateLimit-Bucket An opaque, stable name of the bucket; routes with the same name share it.
X-RateLimit-Scope On a 429: user (yours), shared (a resource everyone uses: one interaction, one site) or global.
X-RateLimit-Global On a 429 for the global limit: true.
Retry-After On a 429: whole seconds (rounded up).

The 429 body is Discord's: {"message": "You are being rate limited.", "retry_after": 1.234, "global": false, "code": 90003} (retry_after in seconds with decimals). Where a request hit several limits the answer reports the most constraining one: the one that refused it, else the one with the fewest requests left. The answer also carries Via: 1.1 tether, which discord.py needs to tell a rate limit from a Cloudflare ban.

How the limits work

  • Fixed windows that start with the first request, counted per person (a bot is a person here) and, for most buckets, per channel or server.
  • A global limit for bots. A bot may make 50 requests a second in all (a person is not held to it). Past that it is 429 with X-RateLimit-Global: true and no bucket headers.
  • Slow mode is not a bucket. A channel's slow mode is its own 429 with code 20016 and retry_after; people who manage the channel skip it.
  • Two buckets on one route. Follow-ups to an interaction count against the interaction (interactionFollowup, shared) and against the bot (interactionFollowupPerBot); the answer reports the tighter one.
  • Not offered: Discord's "invalid request" limit (10 000 failed requests in 10 minutes bans the address). The headers are exposed to the developer site through CORS.
  • A server's operator can multiply the limits for a test server (LITE_RATE_LIMIT_SCALE in dev:lite sets them back to the real ones).

The gateway

Its limits are not HTTP headers, they close the socket (4008) or refuse the request:

  • At most 120 frames a minute on one connection (heartbeats count), and frames are at most 16 KiB.
  • At most 30 IDENTIFYs a minute from one address.
  • Opcode 4 (voice): 20 every 10 seconds per account; a refused one answers with VOICE_STATE_ERROR (90003).
  • Opcode 8 (Request Guild Members): 10 every 30 seconds per account; over it, a request is dropped without an answer.

The routes with a bucket

Each route in the reference lists its own buckets. This is every documented route that has one:

<!-- prettier-ignore-start --> <!-- rate-limit-table:start -->
Route Bucket Limit Counted per
PATCH /users/@me avatarChangePerUser 10 per 1 h user
GET /users/{user.id} userLookupPerUser, userLookupPerHour 30 per 1 min, 300 per 1 h user
PATCH /users/@me/settings guildFoldersPerUser 60 per 1 min user
POST /users/@me/bots botCreatePerUser 10 per 1 h user
PATCH /users/@me/bots/{bot.id} avatarChangePerUser 10 per 1 h user
POST /guilds/{guild.id}/bots botAddPerUser 30 per 1 h user
POST /applications/{application.id}/commands applicationCommandWritePerBot 40 per 1 min user
PUT /applications/{application.id}/commands applicationCommandWritePerBot 40 per 1 min user
PATCH /applications/{application.id}/commands/{command.id} applicationCommandWritePerBot 40 per 1 min user
DELETE /applications/{application.id}/commands/{command.id} applicationCommandWritePerBot 40 per 1 min user
POST /applications/{application.id}/guilds/{guild.id}/commands applicationCommandWritePerBot 40 per 1 min user
PUT /applications/{application.id}/guilds/{guild.id}/commands applicationCommandWritePerBot 40 per 1 min user
PATCH /applications/{application.id}/guilds/{guild.id}/commands/{command.id} applicationCommandWritePerBot 40 per 1 min user
DELETE /applications/{application.id}/guilds/{guild.id}/commands/{command.id} applicationCommandWritePerBot 40 per 1 min user
POST /oauth2/authorize botAddPerUser 30 per 1 h user
POST /oauth2/authorize appAuthorizePerUser 30 per 1 h user
POST /oauth2/token appTokenPerIp 30 per 5 min user
POST /oauth2/token/revoke appTokenPerIp 30 per 5 min user
POST /guilds guildCreatePerUser 10 per 1 h user
PUT /guilds/{guild.id}/voice-host voiceHostManagePerUser 20 per 10 min user
DELETE /guilds/{guild.id}/voice-host voiceHostManagePerUser 20 per 10 min user
POST /users/@me/channels dmCreatePerUser 30 per 1 h user
POST /channels/{channel.id}/voice-channel-effects voiceEffectPerUser 8 per 5 s user
POST /channels/{channel.id}/voice-e2ee/keys voiceE2eeKeysPerUser 40 per 10 s user
POST /channels/{channel.id}/voice-e2ee/request voiceE2eeRequestPerUser 20 per 10 s user
POST /channels/{channel.id}/voice-host voiceHostManagePerUser 20 per 10 min user
DELETE /channels/{channel.id}/voice-host voiceHostManagePerUser 20 per 10 min user
POST /channels/{channel.id}/voice-host/unreachable voiceHostUnreachablePerUser 6 per 1 min user
POST /channels/{channel.id}/messages messageCreatePerUserChannel 10 per 5 s user
GET /guilds/{guild.id}/messages/search searchPerUser 20 per 10 s user
GET /channels/{channel.id}/messages/search searchPerUser 20 per 10 s user
POST /channels/{channel.id}/typing typingPerUserChannel 2 per 5 s user
PUT /channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me reactionAddPerUserChannel 20 per 5 s user
PUT /channels/{channel.id}/messages/pins/{message.id} pinPerUserChannel 10 per 10 s user
DELETE /channels/{channel.id}/messages/pins/{message.id} pinPerUserChannel 10 per 10 s user
PUT /channels/{channel.id}/sticky/{message.id} pinPerUserChannel 10 per 10 s user
DELETE /channels/{channel.id}/sticky/{message.id} pinPerUserChannel 10 per 10 s user
PUT /channels/{channel.id}/polls/{message.id}/answers/@me pollVotePerUserChannel 20 per 10 s user
POST /channels/{channel.id}/messages/{message.id}/threads threadCreatePerUserChannel 10 per 1 min user
POST /channels/{channel.id}/threads threadCreatePerUserChannel 10 per 1 min user
PUT /channels/{thread.id}/thread-members/{user.id} threadMemberPerUserChannel 20 per 10 s user
DELETE /channels/{thread.id}/thread-members/{user.id} threadMemberPerUserChannel 20 per 10 s user
POST /channels/{channel.id}/attachments attachmentRequestPerUser 30 per 1 min user
POST /guilds/{guild.id}/emojis emojiCreatePerUserGuild 30 per 1 h user
POST /guilds/{guild.id}/scheduled-events eventCreatePerUserGuild 20 per 1 h user
PATCH /guilds/{guild.id}/scheduled-events/{event.id} eventChangePerUserGuild 30 per 1 h user
DELETE /guilds/{guild.id}/scheduled-events/{event.id} eventChangePerUserGuild 30 per 1 h user
PUT /guilds/{guild.id}/scheduled-events/{event.id}/users/@me eventInterestPerUser 60 per 1 min user
DELETE /guilds/{guild.id}/scheduled-events/{event.id}/users/@me eventInterestPerUser 60 per 1 min user
POST /guilds/{guild.id}/stickers stickerCreatePerUserGuild 30 per 1 h user
POST /channels/{channel.id}/invites inviteCreatePerUser 30 per 10 min user
POST /interactions/{interaction.id}/{interaction.token}/callback interactionCallback 10 per 10 s shared
POST /webhooks/{application.id}/{interaction.token} interactionFollowup, interactionFollowupPerBot 10 per 10 s, 50 per 10 s shared, user
GET /webhooks/{application.id}/{interaction.token}/messages/@original interactionFollowup, interactionFollowupPerBot 10 per 10 s, 50 per 10 s shared, user
PATCH /webhooks/{application.id}/{interaction.token}/messages/@original interactionFollowup, interactionFollowupPerBot 10 per 10 s, 50 per 10 s shared, user
DELETE /webhooks/{application.id}/{interaction.token}/messages/@original interactionFollowup, interactionFollowupPerBot 10 per 10 s, 50 per 10 s shared, user
PUT /channels/{channel.id}/player playerStatePerBot 20 per 5 s user
<!-- rate-limit-table:end --> <!-- prettier-ignore-end -->

Routes not in the table are not limited beyond the bot-wide 50 a second.