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 TierMonthly QuotaBurst LimitPriceBest For
Starter500 req/mo10 req/sec$0 / FreePersonal projects, testing, prototype builds.
Developer9,000 req/mo30 req/sec$9 / moIndie developers, mobile apps, specialized websites.
Professional29,000 req/mo60 req/sec$29 / moHigh-traffic portals, media outlets, analytical services.
Enterprise890,000 req/mo200 req/sec$89 / moSportsbooks, lottery syndicates, enterprise platforms.

Rate Limit Response Headers

Inspect these headers on every API response to monitor remaining request capacity:

HeaderExample ValueDescription
X-RateLimit-Limit9000Maximum allowed requests in your current monthly billing period.
X-RateLimit-Remaining8420Remaining API requests available until the reset timestamp.
X-RateLimit-Reset1788220800Unix epoch timestamp indicating when your quota resets.
Retry-After60Returned 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
}