Limits and usage¶
The module includes normal use. There are two kinds of limits: the included usage, counted over the month or the day, and the per-minute limits, which protect the service from a program stuck in a loop.
Included usage¶
| What | Included | Counted |
|---|---|---|
| API requests | 5,000 per month | per organization, all keys together |
| Assistant calls (MCP) | 300 per month and 100 per day | per person, all their assistants together |
| Writes | 50 per day | per key |
| Excel exports | 5 per day | per organization |
Months and days are calendar ones, in the organization's time zone: the counters restart on the first of the month and at midnight.
For scale: a management system that every half hour reads the changed shifts and the changed availabilities makes about three thousand requests a month.
A request with dry_run=true and a response replayed for the same
Idempotency-Key (see Writing) do not count as writes: they count
as requests.
A write refused by the checks on its fields or by the calendar (a 400, a 404,
a 409 not_allowed) does count as a write, in the per-minute limits and in
the daily ceiling: writes are counted when the request passes the limits,
before it runs. Refusals that come earlier do not count as writes: the
credential (401), the permissions (403), the limits (429).
Per-minute limits¶
| What | Limit |
|---|---|
| API requests | 20 per minute per organization |
| Writes | 10 per minute per key |
| Excel exports | 1 per minute per organization |
| Requests without a valid key | 20 per minute per IP address |
The windows are fixed: a calendar minute, not the last sixty seconds.
The per-IP limit applies only to requests without a key or with a refused one. A valid key gets through even from an address that has used up that limit.
The headers¶
Every answer to a request with a valid key carries:
| Header | Value |
|---|---|
X-RateLimit-Limit |
requests allowed in the tightest per-minute window |
X-RateLimit-Remaining |
requests left in that window |
X-RateLimit-Reset |
when the window ends, in Unix seconds |
X-Quota-Limit |
requests included in the month |
X-Quota-Remaining |
included requests left in the month |
Retry-After |
on a 429 only: seconds to wait |
The 429¶
Two codes, the same HTTP answer:
rate_limited: a per-minute limit. Wait the seconds inRetry-Afterand retry.quota_exceeded: the included usage is used up.Retry-Afterlasts until the end of the period: for the month's requests, the first of next month; for the day's writes and exports, midnight.
HTTP/1.1 429 Too Many Requests
Retry-After: 37
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1797926460
{"error": {"code": "rate_limited", "message": "Too many requests. Slow down and retry after the time in Retry-After."}}
A well-behaved client reads Retry-After and waits, without retrying at
once: refused attempts are counted too.
Notices¶
At 80% and 100% of the requests included in the month the administrators get an email, one per threshold and per month, and the API keys page shows a notice. The month's usage, and the previous months' key by key, is on the same page. Nothing is charged automatically: past the ceiling requests are refused, not billed.
The usage on the page is complete when you open it: it includes the requests just made, also those of a key or an assistant that has not worked since. The ceilings are counted apart, request by request, and apply as soon as they are passed.
Getting more¶
If the included usage is not enough, write to info@apptome.it: an organization's ceilings are raised without touching keys or programs, for an agreed extra. The per-minute limits are not raised.
First, look at how the program works: with updated_since (see
Syncing) a sync reads only what changed, and usually needs
a fraction of the requests.