Rate limits
A token bucket per key (or per address, if you are calling anonymously) — a steady rate, with room to burst.
How the bucket works#
Each caller has a bucket of tokens. It refills continuously — a tier priced at 60 requests a minute adds one token every second — up to the tier’s burst depth, and every request spends exactly one token. Two numbers, not one, because they answer two different questions: perMinute is what you may sustain all day; burst is how many of those you may spend at once before the refill has to catch up. A page that fires a dozen calls in parallel and then goes quiet needs burst, not perMinute, to behave.
The bucket belongs to your key, not to your account — three keys on one grant are three separate budgets. Calling with no key (where a service allows it) buckets by IP address instead, since that is the only identity an anonymous caller has.
Tiers on this deployment#
| Tier | Sustained | Burst | Per-service overrides |
|---|---|---|---|
elevated | 600 / minute | up to 100 at once | — |
standard | 60 / minute | up to 20 at once | search: 10/min |
anonymous | 20 / minute | up to 10 at once | search: 5/min |
A per-service override replaces the general rate for just that service — search is the usual example, since a keyword search costs more than an id lookup. Everything without an override shares the tier’s general bucket.
The three headers#
Every response that reached the rate limiter carries your current budget — a successful call, an error from the endpoint itself, and the limiter’s own 429:
x-ratelimit-limit: 60 # your tier's sustained rate
x-ratelimit-remaining: 41 # whole tokens left after THIS request
x-ratelimit-reset: 17 # seconds until the bucket is FULL againx-ratelimit-reset is deliberately "back to full", not "one more token" — it is the honest answer to "when am I back to normal". If all you need is to send one more request as soon as possible, that is what Retry-After on a 429 is for, below, and the two numbers can legitimately differ.
A request refused before the limiter runs carries none of these headers: a 401 for a missing or unrecognised key, a 403 for a service your key cannot use, and a 503 while the API is switched off. There is no budget to report for a request that was never priced. Read the headers when they are present; do not treat their absence as zero.
Going over budget#
An empty bucket answers 429, with a Retry-After header giving the seconds until one token exists — not until the bucket refills completely, which would idle a client far longer than necessary for a single retry:
{
"errors": [
{
"code": 0,
"message": "Too many requests."
}
]
}An endpoint that had its own 429 in the original API answers with that one instead, word for word — its reference page lists it — so code written against the endpoint already knows the body. On the legacy service the body is {"code":429,"message":"TooManyRequests"}.
Guessing at keys is priced separately and earlier: an address that fails authentication 30 times in 5 minutes is refused before the key lookup even runs, with its own 429 and its own Retry-After (but no x-ratelimit-* headers, since no key was priced). A correct key is never throttled by that guard, however hard it is used — only the token bucket above prices real traffic.
Retrying politely#
Read Retry-After and wait at least that long before the next attempt — do not poll immediately:
response=$(curl -s -o /dev/null -w "%{http_code} %{header_json}" \
-H "Authorization: Bearer rbx_live_YOUR_KEY" "http://rbx.jumpathy.dev/v2/api/users/v1/users/1")
status="${response%% *}"
if [ "$status" = "429" ]; then
# Read Retry-After from the response and sleep that many seconds, then retry.
sleep "$RETRY_AFTER"
fi