Staying under the rate limits
developers-staying-under-limitsOn this page
Cache your token, read less, let webhooks do the polling, and watch the headers.
Limits are counted per minute: 60 calls for one app, 600 for all of an organisation's apps together, and 10 token requests for each client id and IP address. The full table is in Rate limits. A few habits keep you well under them.
1. One token an hour
An access token lasts an hour. Cache it and reuse it, rather than asking for one per call. See How long does an access token last?.
2. Read less
- Follow changes, don't re-read everything. Sync mode returns only what changed since your cursor. See Keep your system in sync.
- Take 100 at a time with
per_page=100: fewer calls for the same records. - Send back the
ETagasIf-None-Matchwhen you re-read something you've kept, such asGET /job-lookups. An unchanged answer is a short304. It still counts as a call, but saves the download. See Conditional requests. - Filter on the server (
job_id,invoice_id,status, and on contactsemail,phoneandsearch) instead of downloading a list and filtering it yourself.
3. Let webhooks tell you
Instead of asking every minute whether anything changed, subscribe to events and Skeduler calls you. See How webhooks work.
4. Watch the headers
Every authenticated response says how many calls are left in the tightest bucket:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Calls allowed per minute in that bucket |
X-RateLimit-Remaining | Calls left this minute |
When Remaining gets low, pause or slow your queue until the minute turns over.
async function paced(call) {
const res = await call();
if (Number(res.headers.get("X-RateLimit-Remaining")) < 5) await new Promise((r) => setTimeout(r, 5000));
return res;
}
5. Share the business's 600
The 600 a minute is shared by every app in the business, so opening a second app doesn't buy more. If several integrations run together, give the busy one a share and keep a little spare.
If you do hit a limit, see I get 429 Too Many Requests.