Rate limits
Generous limits, said in every answer.
Limits are per minute, counted in windows that start on the minute.
| Limit | Per minute |
|---|---|
| Requests from one app for one person (or one token) | 600 |
| Of those, requests that change something (POST, PATCH, DELETE) | 120 |
| All apps and tokens of one organisation together | 3000 |
| Recipients of mail sent through the API, per person | 500 an hour |
Every answer says where you stand: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (seconds until the window starts again). Over a limit you get 429 rate_limited with Retry-After.
Waiting it out
async function call(url, init, tries = 4) {
const res = await fetch(url, init);
if (res.status === 429 && tries > 0) {
const wait = Number(res.headers.get("Retry-After") ?? 1);
await new Promise((r) => setTimeout(r, wait * 1000));
return call(url, init, tries - 1);
}
return res;
}Polling? Don't: mail has a changes feed you can hold open, and the business apps send webhooks.