Rate Limits & Quotas
To ensure high availability and fair performance across our global infrastructure, US Lottery API enforces request rate limits and monthly call quotas per account tier.
Plan Quotas & Rate Limits
| Plan Tier | Monthly Quota | Burst Limit | Price | Best For |
|---|---|---|---|---|
| Starter | 500 req/mo | 10 req/sec | $0 / Free | Personal projects, testing, prototype builds. |
| Developer | 9,000 req/mo | 30 req/sec | $9 / mo | Indie developers, mobile apps, specialized websites. |
| Professional | 29,000 req/mo | 60 req/sec | $29 / mo | High-traffic portals, media outlets, analytical services. |
| Enterprise | 890,000 req/mo | 200 req/sec | $89 / mo | Sportsbooks, lottery syndicates, enterprise platforms. |
Rate Limit Response Headers
Inspect these headers on every API response to monitor remaining request capacity:
| Header | Example Value | Description |
|---|---|---|
| X-RateLimit-Limit | 9000 | Maximum allowed requests in your current monthly billing period. |
| X-RateLimit-Remaining | 8420 | Remaining API requests available until the reset timestamp. |
| X-RateLimit-Reset | 1788220800 | Unix epoch timestamp indicating when your quota resets. |
| Retry-After | 60 | Returned during 429 errors. Number of seconds to pause before retrying. |
Exponential Backoff Implementation
Resilient Retry Code Pattern
// Resilient API Call Handler with Exponential Backoff & Retry
async function fetchWithRetry(url, options = {}, retries = 3, delayMs = 1000) {
for (let attempt = 1; attempt <= retries; attempt++) {
try {
const response = await fetch(url, options);
// Inspect Rate Limit Headers
const remaining = response.headers.get("X-RateLimit-Remaining");
console.log(`Rate Limit Remaining: ${remaining}`);
if (response.status === 429) {
const retryAfter = response.headers.get("Retry-After") || (delayMs / 1000);
console.warn(`Rate limit exceeded. Waiting ${retryAfter} seconds...`);
await new Promise(res => setTimeout(res, retryAfter * 1000));
delayMs *= 2; // Exponential backoff
continue;
}
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (err) {
if (attempt === retries) throw err;
console.warn(`Attempt ${attempt} failed. Retrying in ${delayMs}ms...`);
await new Promise(res => setTimeout(res, delayMs));
delayMs *= 2;
}
}
}
fetchWithRetry("https://uslotteryapi.com/api/v1/draws/latest?game=powerball", {
headers: { "x-api-key": process.env.US_LOTTERY_API_KEY }
});429 Too Many Requests JSON Payload
{
"status": "error",
"code": 429,
"error_type": "TOO_MANY_REQUESTS",
"message": "API monthly quota or burst rate limit exceeded. Please wait or upgrade your plan.",
"timestamp": "2026-08-03T01:50:00Z",
"retry_after_seconds": 60
}