Skip to content

Guides

How do I get NFL Next Gen Stats in Python?

Season passing tracking metrics for every qualifying quarterback: time to throw, air yards, aggressiveness and completion percentage above expectation.

Code verified October 10, 2026. One call to get_advanced_stats, 5 credits.

The call

Week 0 is the season aggregate. Other sources are ngs_rushing, ngs_receiving and the Pro Football Reference sets.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.endzoneapi.com/v1/get_advanced_stats",
    headers={"x-api-key": API_KEY},
    json={
        "source": "ngs_passing",
        "season": 2025,
        "week": 0,
        "limit": 40,
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

qbs = pd.json_normalize(data["stats"])
cols = ["name", "team", "metrics.attempts", "metrics.avg_time_to_throw", "metrics.aggressiveness", "metrics.completion_percentage_above_expectation"]
out = qbs[cols].rename(columns=lambda c: c.replace("metrics.", ""))
print(out.sort_values("completion_percentage_above_expectation", ascending=False).head(10).round(2))

Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.

What comes back

The data object of the response, trimmed to the first rows. Every field is real output from the run above.

{
  "source": "ngs_passing",
  "season": 2025,
  "player_id_kind": "gsis (see search_players player_id)",
  "stats": [
    {
      "season": 2025,
      "season_type": "REG",
      "week": 0,
      "player_id": "00-0023459",
      "name": "Aaron Rodgers",
      "position": "QB",
      "team": "PIT",
      "metrics": {
        "attempts": 498,
        "pass_yards": 3322,
        "completions": 327,
        "interceptions": 7,
        "passer_rating": 94.80421686746988,
        "aggressiveness": 14.457831325301203,
        "pass_touchdowns": 24,
        "avg_air_distance": 19.69191154106132,
        "max_air_distance": 69.30092351476999,
        "avg_time_to_throw": 2.5922096774193553,
        "completion_percentage": 65.66265060240963,
        "avg_intended_air_yards": 5.995137420718817,
        "avg_air_yards_to_sticks": -3.0302325581395353,
        "avg_completed_air_yards": 3.3634556574923544,
        "avg_air_yards_differential": -2.6316817632264624,
        "max_completed_air_distance": 56.0303132241825,
        "expected_completion_percentage": 66.61178714859439,
        "completion_percentage_above_expectation": -0.9491365461847608
      }
    },
    {
      "season": 2025,
      "season_type": "REG",
      "week": 0,
      "player_id": "00-0034855",
      "name": "Baker Mayfield",
      "position": "QB",
      "team": "TB",
      "metrics": {
        "attempts": 543,
        "pass_yards": 3693,
        "completions": 343,
        "interceptions": 11,
        "passer_rating": 90.58087783916514,
        "aggressiveness": 16.390423572744016,
        "pass_touchdowns": 26,
        "avg_air_distance": 21.26395350723226,
        "max_air_distance": 61.09329341261608,
        "avg_time_to_throw": 2.846171586715867,
        "completion_percentage": 63.16758747697975,
        "avg_intended_air_yards": 8.087386363636362,
        "avg_air_yards_to_sticks": -0.6891287878787878,
        "avg_completed_air_yards": 5.1295626822157425,
        "avg_air_yards_differential": -2.95782368142062,
        "max_completed_air_distance": 61.09329341261608,
        "expected_completion_percentage": 64.83830258302584,
        "completion_percentage_above_expectation": -1.6707151060460887
      }
    },
    "...38 more"
  ],
  "count": 40
}

What to do next

  • get_plays (10 credits). Play-level EPA and CPOE for the same passers.
  • search_players (2 credits). Find a GSIS id to pass as player_id for one passer's weeks.

More guides

Start with 500 free credits

No card. REST or MCP.