Skip to main content

Rate limits

Rate limiting is a fixed window:

  • Each named bucket allows a set number of calls.
  • Anything past that returns 429 Too Many Requests.
  • A bucket refills ten seconds after the first request that filled it.

Buckets are independent. Exhausting one does not affect any other, so a client hammering message sends does not lose its ability to fetch a channel.

Buckets

MethodPathLimit
/users20
PATCH/users/:id2
/users/:id/default_avatar255
/bots10
/channels15
POST/channels/:id/messages10
/servers5
/auth3
DELETE/auth255
/safety15
/safety/report3
/swagger100
/*20

Headers

Every response carries enough to stay under the limit without guessing.

HeaderTypeDescription
X-RateLimit-LimitnumberCalls allowed for this bucket
X-RateLimit-BucketstringIdentifier of the bucket that was charged
X-RateLimit-RemainingnumberCalls left in it
X-RateLimit-Reset-AfternumberMilliseconds until it refills

Read X-RateLimit-Bucket rather than inferring which bucket a route belongs to from its path — the mapping is a server-side decision and may change.

Being limited

A 429 carries a body saying how long to wait:

interface Response {
// Milliseconds until calls are replenished
retry_after: number;
}

Wait for retry_after rather than retrying on a timer of your own. Retrying sooner does not make the window shorter; it just spends the next one.