Rate Limiting
The Shrinkr API enforces rate limits to ensure fair usage and platform stability. Rate limits are applied per API key (or per session for dashboard users).
Limits by Plan
| Plan | Requests | Window |
|---|---|---|
| Free | 10 | per minute |
| Pro | 100 | per minute |
Rate Limit Headers
Every API response includes rate limit headers:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the current window |
X-RateLimit-Remaining | Remaining requests in the current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
Example Response Headers
HTTP/1.1 200 OK
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 97
X-RateLimit-Reset: 1709312460Handling Rate Limits
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
json
{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Please try again later.",
"status": 429
}
}Best Practices
- Check the headers — monitor
X-RateLimit-Remainingto avoid hitting limits - Implement backoff — if you receive a 429, wait until
X-RateLimit-Resetbefore retrying - Batch requests — combine multiple operations where possible instead of making individual calls
- Cache responses — avoid re-fetching data that hasn't changed
Retry Example
javascript
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const res = await fetch(url, options);
if (res.status === 429) {
const resetTime = res.headers.get("X-RateLimit-Reset");
const waitMs = resetTime
? (parseInt(resetTime) * 1000) - Date.now()
: 60000;
await new Promise(r => setTimeout(r, Math.max(waitMs, 1000)));
continue;
}
return res;
}
throw new Error("Max retries exceeded");
}Need Higher Limits?
If you need higher rate limits for your use case, consider upgrading to the Pro plan from Dashboard → Subscription.