statshawk
Cookbook

NFL drive chart

Every drive of an NFL game with its result, plays, and scoring — from football play-by-play.

Drive chart for a game

nfl_drives.py
import os, requests
KEY = os.environ["STATSHAWK_KEY"]
BASE = "https://api.statshawk.ai/v1"

games = requests.get(
    f"{BASE}/competitions/nfl/editions/2026/games",
    headers={"X-API-Key": KEY},
    params={"stage": "preseason", "date": "2026-08-13"},
    timeout=10,
).json()["data"]["items"]

pbp = requests.get(
    f"{BASE}/contests/{games[0]['id']}/play-by-play",
    headers={"X-API-Key": KEY},
    timeout=15,
).json()["data"]

for d in pbp["drives"]:
    plays = d.get("plays") or []
    print(
        f"D{d['drive_number']:>2} {d['team']['name']:<22} "
        f"{d.get('offensive_plays', len(plays)):>2} plays "
        f"{d.get('yards', 0):>3} yds → {d.get('display_result') or d.get('result')}"
    )
Open the contest play-by-play endpoint in the playground →

On this page