Rate Limiting
To ensure platform stability and fair usage, the NRS API applies request rate limits.
If your application exceeds the allowed request threshold, the API returns a 429 Too Many Requests response.
Rate Limit Response
{
"ok": false,
"error": "Rate limit exceeded"
}
HTTP Status Code
| Status Code | Meaning |
|---|---|
429 | Too many requests |
Recommended Handling
When a 429 response is received:
- Pause additional requests temporarily.
- Retry the request after a short delay.
- Use exponential backoff for repeated retries.
Example retry intervals:
| Attempt | Delay |
|---|---|
| 1 | 1 second |
| 2 | 2 seconds |
| 3 | 4 seconds |
| 4 | 8 seconds |
Best Practices
- Cache responses where possible.
- Avoid sending duplicate requests.
- Queue bulk invoice operations.
- Use retry logic with exponential backoff.
- Monitor application request volume.
Example Retry Logic
async function requestWithRetry(fn, retries = 4) {
let delay = 1000;
for (let i = 0; i < retries; i++) {
try {
return await fn();
} catch (error) {
if (error.status !== 429) {
throw error;
}
await new Promise(resolve => setTimeout(resolve, delay));
delay *= 2;
}
}
throw new Error("Rate limit exceeded");
}
Notes
- Excessive repeated failures may trigger temporary blocking.
- Rate limits may vary between environments.
- Bulk invoice submissions should be batched responsibly.