Engineering · 2026-11-26 · 7 min read

Querying NFL Play-by-Play EPA & Win Probability via REST (Without Managing Parquet Files)

How to pull nflverse EPA, WPA, air yards, YAC and drive summaries over fast edge JSON endpoints instead of maintaining R or Python Parquet pipelines.

Why production apps move off raw Parquet pipelines

nflverse is the open-data gold standard for NFL analytics under CC BY 4.0. Its play-by-play tables publish Expected Points Added (EPA), Win Probability Added (WPA), air yards, yards after catch, down-and-distance context and player IDs for every snap.

For batch research in R or Python, downloading multi-hundred-megabyte seasonal Parquet or gzipped CSV files works well. For production web apps, Discord bots, fantasy dashboards and serverless functions, bundling seasonal files or running scheduled ETL workers just to inspect one Sunday game adds cold-start latency, memory overhead and schema-migration work.

OpenPigskin indexes the nflverse archive into deterministic JSON documents served from Cloudflare Workers and D1 — covering 7,440 games across 28 seasons (1999–2026) and 98,263 indexed play-by-play snaps across 570 detailed games — with sub-second filtered reads and cursor pagination.

Filter the snap ledger by quarter, drive, team or play type

Every detailed game exposes GET /v1/games/{id}/plays (Developer plan and above). Instead of downloading an entire season file and filtering in memory, pass query parameters directly: quarter (1–6, where 5 is overtime), drive (1–60), team (possession abbreviation such as SEA or NE) and play_type (for example pass, run, punt or field_goal).

Results are returned 100 plays per page with meta.total, meta.count and meta.next_cursor. In Super Bowl LX (game_nfl_2025_22_SEA_NE, where the Seattle Seahawks beat the New England Patriots 29–13 on 2026-02-08), the full snap ledger contains 193 plays across 28 drives — filtering to pass plays lets you inspect passing efficiency in a single request.

bash
curl "https://openpigskinapi.com/v1/games/game_nfl_2025_22_SEA_NE/plays?play_type=pass&team=SEA" \
  -H "Authorization: Bearer op_live_YOUR_KEY"

Inside the play-by-play JSON schema

Every snap carries normalized fields so you do not have to reconcile legacy column names or historical franchise codes (OAK, SD, STL, LAR, WSH and JAC are normalized to LV, LAC, LA, WAS and JAX). Missing measurements stay explicitly null — nothing is imputed or guessed.

Below is an actual play record from Drive 1 of Super Bowl LX (play_id 106): Sam Darnold's 15-yard completion to AJ Barner with 4 air yards, 11 yards after catch, +1.214 EPA and +0.0679 WPA, alongside the standard nflverse attribution envelope.

json
{
  "data": [
    {
      "play_id": 106,
      "drive": 1,
      "quarter": 1,
      "clock": "13:50",
      "posteam": "SEA",
      "defteam": "NE",
      "down": 2,
      "yards_to_go": 10,
      "yardline_100": 55,
      "play_type": "pass",
      "yards_gained": 15,
      "epa": 1.214,
      "wpa": 0.0679,
      "home_wp": 0.5557,
      "air_yards": 4,
      "yards_after_catch": 11,
      "touchdown": false,
      "interception": false,
      "sack": false,
      "fumble_lost": false,
      "passer_id": "player_nfl_00-0034869",
      "passer_name": "S.Darnold",
      "rusher_id": null,
      "rusher_name": null,
      "receiver_id": "player_nfl_00-0039793",
      "receiver_name": "A.Barner",
      "away_score": 0,
      "home_score": 0,
      "description": "(13:50) (Shotgun) 14-S.Darnold pass short left to 88-A.Barner to NE 40 for 15 yards (31-C.Woodson)."
    }
  ],
  "meta": {
    "request_id": "req_01example",
    "source": "nflverse",
    "source_url": "https://github.com/nflverse/nflverse-data",
    "licence": "CC BY 4.0",
    "licence_url": "https://creativecommons.org/licenses/by/4.0/",
    "game_id": "game_nfl_2025_22_SEA_NE",
    "total": 193,
    "count": 100,
    "next_cursor": "100"
  }
}

Paginate a full game and compute pass vs. run EPA in TypeScript

Because every page returns an explicit string meta.next_cursor (or null on the final page), pulling a complete game ledger takes a small loop. From the plays array you can compute EPA per play, success rate (percentage of snaps with EPA > 0) and average air yards without any data-frame dependency.

typescript
type Play = {
  posteam: string | null;
  play_type: string | null;
  epa: number | null;
  air_yards: number | null;
};

async function fetchAllPlays(gameId: string, apiKey: string): Promise<Play[]> {
  const all: Play[] = [];
  let cursor: string | null = null;

  do {
    const url = new URL(`https://openpigskinapi.com/v1/games/${gameId}/plays`);
    if (cursor) url.searchParams.set("cursor", cursor);

    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${apiKey}` },
    });
    if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);

    const json = (await res.json()) as {
      data: Play[];
      meta: { next_cursor: string | null };
    };
    all.push(...json.data);
    cursor = json.meta.next_cursor;
  } while (cursor);

  return all;
}

export async function summarizeEpa(gameId: string, apiKey: string) {
  const plays = await fetchAllPlays(gameId, apiKey);
  const scrimmage = plays.filter(
    (p) => (p.play_type === "pass" || p.play_type === "run") && p.epa !== null,
  );

  const byTeam = new Map<string, { snaps: number; totalEpa: number; positive: number }>();
  for (const p of scrimmage) {
    if (!p.posteam || p.epa === null) continue;
    const row = byTeam.get(p.posteam) ?? { snaps: 0, totalEpa: 0, positive: 0 };
    row.snaps += 1;
    row.totalEpa += p.epa;
    if (p.epa > 0) row.positive += 1;
    byTeam.set(p.posteam, row);
  }

  return Object.fromEntries(
    [...byTeam.entries()].map(([team, s]) => [
      team,
      {
        snaps: s.snaps,
        epaPerPlay: Number((s.totalEpa / s.snaps).toFixed(3)),
        successRate: Number((s.positive / s.snaps).toFixed(3)),
      },
    ]),
  );
}

Avoid over-fetching: pair /plays with /drives, /boxscore and /games/{id}

If your view only needs top-level team EPA, coaches, starting QBs, weather or quarter scores, call GET /v1/games/{id} (available on the free Starter plan). For example, /v1/games/game_nfl_2025_22_SEA_NE directly reports Seattle's +3.24 team EPA against New England's -12.836 without paging through 193 snaps.

When you need possession-level summaries, call GET /v1/games/{id}/drives instead of grouping plays client-side. And if you query an older historical game where play-by-play snaps have not been imported, OpenPigskin strictly returns HTTP 404 with error.code set to feature_not_available rather than synthesizing placeholder records.

Get a free API key →← All guides