Rate limits
The API limits the requests of each API key and of each OAuth client. The browser session of the ERP has no such limit.
The limits
Section titled “The limits”| Credential | Counted for | Default limit |
|---|---|---|
| API key (personal or service) | The key | 600 requests a minute |
| OAuth access token (user token or server client token) | The client in one tenant | 600 requests a minute |
The operator of a Posto server can change the defaults. The API key limit and the OAuth limit are separate settings.
An OAuth client has a separate count in each tenant. Two clients in the same tenant have separate counts.
How the API counts
Section titled “How the API counts”- The API counts in fixed minutes of the database clock. Each minute starts at second 0. The count starts again at 0 in each new minute.
- Each request counts, also a request that fails. A request that gets
422or500counts too. - All servers of the API share one count, because the count is in the database. More servers do not give more requests.
Over the limit
Section titled “Over the limit”The request that goes over the limit gets 429 with a Retry-After header. The header gives the seconds until the minute ends:
HTTP/1.1 429 Too Many RequestsRetry-After: 51Content-Type: application/json
{"error":{"code":"rate_limited","message":"Too many requests. Try again later."}}Each request after it in the same minute also gets 429. The API does not do the action of a refused request.
Stay under the limit
Section titled “Stay under the limit”- Read a list once, and keep the rows that you need. The list routes return all rows in one answer.
- On
429, wait the seconds ofRetry-After. Then send the request again. - Use one key for each program. Then one busy program does not stop the others.
Sign-in endpoints
Section titled “Sign-in endpoints”In production, the endpoints under /api/auth have their own rate limit. It is not the limit on this page.