Architecture · 2026-11-26 · 7 min read

Polling Live NFL Scores on Sunday Without Burning Your Rate Limit

Architecture patterns for /v1/live, /v1/live/{id} and /v1/schedule: 20-second refresh cadence, caching headers, game_espn_* vs. game_nfl_* IDs and explicit ESPN attribution.

Why naive client polling melts Sunday quotas

NFL traffic is uniquely spiky: roughly 80% of live scoreboard demand happens inside two three-hour windows on Sunday afternoon (1:00 PM and 4:05/4:25 PM ET), plus Thursday, Sunday and Monday night primetime games. If 500 browser tabs each poll your NFL API directly every 5 seconds, you generate 6,000 requests per minute — burning through rate limits while fetching the exact same scoreboard payload hundreds of times.

OpenPigskin's live layer refreshes upstream about every 20 seconds and sends Cache-Control: private, max-age=10, while deduplicating concurrent upstream fetches per Cloudflare edge location. Polling faster than once every 20 seconds per backend worker does not produce fresher scores; it only spends your request budget. Instead, run a single server-side poller that writes to Redis, KV or an in-memory cache and fans out to clients over SSE, WebSockets or short-TTL CDN responses.

Combine /v1/schedule, /v1/live and /v1/live/{id} cleanly

Start by calling GET /v1/schedule (up to a 14-day window: from defaults to today UTC and to can be at most 13 days after from, cached for 300 seconds upstream) once per hour or once per day to discover kickoff timestamps, broadcast networks and venues. That lets your poller sleep on Tuesday through Saturday morning.

During active kickoff windows, poll GET /v1/live?state=in every 20 seconds. That single call returns every in-progress game with scores, quarter, clock, possession_abbr, down_distance, is_red_zone and last_play. Only drill into GET /v1/live/{id} (which returns the 15 most recent scoring_plays and game-center detail) when a game's score or last_play actually changes, or when a user explicitly opens that game's detail screen.

bash
# 1. Pull the next 7 days of kickoffs (default window: today -> today + 6 days)
curl "https://openpigskinapi.com/v1/schedule" \
  -H "Authorization: Bearer op_live_YOUR_KEY"

# 2. Poll only games currently in progress (refreshed ~every 20s)
curl "https://openpigskinapi.com/v1/live?state=in" \
  -H "Authorization: Bearer op_live_YOUR_KEY"

# 3. Inspect scoring plays for one live game_espn_* ID
curl "https://openpigskinapi.com/v1/live/game_espn_401671793" \
  -H "Authorization: Bearer op_live_YOUR_KEY"

Bridging game_espn_* live IDs and game_nfl_* archive IDs

Live endpoints return ESPN-backed game IDs formatted as game_espn_{event_id} (for example game_espn_401671793), whereas historical archive endpoints use nflverse IDs formatted as game_nfl_{season}_{week}_{away}_{home} (for example game_nfl_2025_22_SEA_NE).

Two deliberate design choices make transitioning from live Sunday coverage to postgame analytics painless. First, every live team object already normalizes ESPN abbreviations (WSH to WAS, LAR to LA) into OpenPigskin's canonical team_nfl_{abbr} IDs. Second, once a game enters the nflverse archive, GET /v1/games/{id} stores external_ids.espn (such as 401772988 on game_nfl_2025_22_SEA_NE), letting you link live game_espn_401772988 state directly to the finalized EPA, drive chart and PPR fantasy-point endpoints.

A quota-aware Sunday poller in TypeScript

OpenPigskin returns X-Plan, X-Quota-Limit, X-Quota-Remaining and X-Request-Id headers on every response (exposed via Access-Control-Expose-Headers) and Retry-After: 60 if you hit HTTP 429. Even on the $19/month Developer plan (250,000 requests/month and 100 requests/minute), polling /v1/live?state=in every 20 seconds for 12 hours every Sunday uses only ~2,160 requests per Sunday — less than 4% of your monthly pool across a four-week month.

typescript
type LiveGame = {
  id: string;
  state: "pre" | "in" | "post";
  away: { id: string; abbr: string; score: number | null };
  home: { id: string; abbr: string; score: number | null };
  situation: { last_play: string | null } | null;
};

const lastFingerprint = new Map<string, string>();

export async function pollActiveSlate(apiKey: string) {
  const res = await fetch("https://openpigskinapi.com/v1/live?state=in", {
    headers: { Authorization: `Bearer ${apiKey}` },
  });

  if (res.status === 429) {
    const retryAfterSec = Number(res.headers.get("Retry-After") ?? "60");
    return { nextPollMs: retryAfterSec * 1000, updatedGames: [] as string[] };
  }
  if (!res.ok) throw new Error(`Live poll failed: HTTP ${res.status}`);

  const remaining = Number(res.headers.get("X-Quota-Remaining") ?? "0");
  const { data, meta } = (await res.json()) as {
    data: LiveGame[];
    meta: { source: string; licence: string | null };
  };

  const updatedGames: string[] = [];
  for (const g of data) {
    const fp = `${g.away.score}-${g.home.score}-${g.situation?.last_play ?? ""}`;
    if (lastFingerprint.get(g.id) !== fp) {
      lastFingerprint.set(g.id, fp);
      updatedGames.push(g.id);
    }
  }

  // Slow down smoothly if no games are currently active
  const nextPollMs = data.length > 0 ? 20_000 : 120_000;
  return { nextPollMs, updatedGames, remaining, source: meta.source };
}

Source transparency: ESPN live data vs. nflverse archive

Every /v1/live, /v1/live/{id} and /v1/schedule response explicitly sets meta.source to "ESPN", meta.licence to null, and includes a meta.note clarifying that live scores and upcoming schedules are collected from ESPN's public scoreboard rather than nflverse.

Be honest about latency fit when architecting your product: a ~20-second edge-cached refresh is ideal for live scoreboards, fantasy companion apps, Discord alerts and second-screen dashboards, whereas regulated in-play sportsbook pricing requires official sub-second push feeds.

Get a free API key →← All guides