Rate limits
How many calls a key may make per minute, the headers that tell you where you stand, and how to handle a 429.
You will know your limit, read it from response headers, and back off correctly when you hit it.
The limits#
Every limit is counted for each API key. There are four.
| Limit | Sandbox | Production |
|---|---|---|
| Calls per minute | 25 by default | 100 by default |
| Burst | 120 in any 10 seconds | 600 in any 10 seconds |
| Report routes and the event list | 10 per minute | 30 per minute |
| Calls in progress at once | 10 | 50 |
Calls per minute. Nurish'd sets this number per company, so yours may differ. GET /developer/v1/key/get/document returns it in rate_limit_per_minute. The console shows it too. To ask for more, email hello@nurishd.io.
Burst. Calls you do not use add up. A key that was quiet can go above its calls per minute for a moment, up to the burst line.
Report routes and the event list. These four routes have their own, lower line:
GET /care/v1/report/query/documentsGET /care/v1/report/{report_id}/get/documentGET /care/v1/report/{report_id}/section/{section_id}/file/get/documentGET /developer/v1/event/query/documents
A call to one of them counts against this line and against your calls per minute.
Calls in progress at once. This counts the calls Nurish'd is still answering for your key. Wait for answers before you send more, or cap your workers below the number.
Passing any of the four answers 429 rate_limited with a Retry-After header.
Headers#
Every authenticated answer, errors included, carries:
| Header | Meaning |
|---|---|
RateLimit-Limit | Calls per minute for this key. |
RateLimit-Remaining | Calls you can make right now. After a quiet moment it can be above the limit. |
Retry-After | Seconds to wait. Only on a 429. |
On a report route and on the event list, both RateLimit headers describe that route's own line.
A 401 carries none of these, because the key could not be identified.
HTTP/1.1 429 Too Many Requests
RateLimit-Limit: 25
RateLimit-Remaining: 0
Retry-After: 12
X-Request-Id: req-0001
Content-Type: application/json
{"error": {"code": "rate_limited", "message": "Too many requests.", "request_id": "req-0001"}}Handle a 429#
- Stop sending calls with that key.
- Wait
Retry-Afterseconds. - Retry the call.
import os
import time
import requests
def get(url, **kwargs):
for _ in range(4):
res = requests.get(url, headers={"X-Partner-API-Key": os.environ["NURISHD_API_KEY"]}, **kwargs)
if res.status_code != 429:
return res
time.sleep(int(res.headers.get("Retry-After", "5")))
return resStay under the limit#
- Read
RateLimit-Remainingand slow down before it reaches zero. - Do not send many calls at the same moment. Keep the calls in progress under the limit.
- Fetch a report once and keep it. Report routes have the lowest limit.
- Use
sizeup to 50 to fetch fewer pages. See Pagination. - Poll events no more often than you need. Use a cursor on
created. See Events. - Cache catalog data that rarely changes, such as vendors and products.
- Spread work from several services over several keys only if each has its own job. Limits are per key.
Next#
- Pagination: fewer calls per list.
- Errors: which errors to retry.
- Events: poll without wasting calls.
Something wrong on this page? Email hello@nurishd.io with the page address.