Rate limits
The limit
300 requests a minute for each key, counted over a sliding minute. Every key has the same limit,
whatever its label. A call with no valid key is refused with 401 before it is counted against any key.
Headers
Every response to a call made with a valid key carries:
| Header | Meaning |
|---|---|
RateLimit-Limit | The limit: 300. |
RateLimit-Remaining | How many calls are left in the current minute. |
RateLimit-Reset | Seconds until the count recovers. |
When you are over the limit the answer is 429 rate_limited with a Retry-After header, in seconds:
HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: 12
RateLimit-Limit: 300
RateLimit-Remaining: 0
RateLimit-Reset: 12
Wait that long before you call again. In a browser your script can read these headers: the API lists them as exposed.
The block rule
A key that keeps getting 429 and goes on calling for 5 minutes is blocked for 15 minutes. While it is
blocked, every call answers 429 rate_limited with Retry-After set to the time left, and the detail says
the key is blocked. A client that honours Retry-After never reaches this.
Staying under it
- Cache what rarely changes. Public reads can be reused by a browser or a CDN for a minute
(
Cache-Control: public, max-age=60), and a club's fixtures do not change by the second. - On your own website, fetch on your server and cache for a few minutes, rather than from every visitor's browser, if you expect more than a few hundred page views a minute.
- Ask for what you need in one call: use the
from/to,competitionandkindfilters and a biggerlimit. - On
429, waitRetry-After. Do not retry in a tight loop.
In the SDK
LovebowlsApiError carries retryAfter (seconds, or null) for a 429:
import { LovebowlsApiError } from "@lovebowls/api";
async function withRetry(call, tries = 3) {
for (let attempt = 1; ; attempt++) {
try {
return await call();
} catch (error) {
const retriable = error instanceof LovebowlsApiError && (error.status === 429 || error.status === 502);
if (!retriable || attempt === tries) throw error;
await new Promise((r) => setTimeout(r, (error.retryAfter ?? 2 ** attempt) * 1000));
}
}
}
const club = await withRetry(() => lb.getClub("CLUB_ID"));