How do I get NBA standings in Python?
NBA standings for 2025-26 computed from every final game: record, scoring margin and last 10 by conference. Oklahoma City finished 64-18.
Code verified October 12, 2026. One call to get_standings, 2 credits.
The call
season is the year it ends, so 2026 is 2025-26, and the default is the latest. Records are computed from final regular-season games. Pass league: "wnba" for the WNBA table.
import requests
import pandas as pd
API_KEY = "YOUR_API_KEY"
resp = requests.post(
"https://mcp.dunkapi.com/v1/get_standings",
headers={"x-api-key": API_KEY},
json={
"season": 2026,
},
timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
table = pd.DataFrame(data["standings"])
print("season", data["season"], "-", len(table), "teams")
cols = ["abbrev", "wins", "losses", "win_pct", "avg_margin", "last10_wins"]
for conf, rows in table.groupby("conference"):
print(conf)
print(rows.sort_values("win_pct", ascending=False)[cols].head(8).to_string(index=False))
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.
{
"season": 2026,
"standings": [
{
"team_id": "25",
"abbrev": "OKC",
"display_name": "Oklahoma City Thunder",
"conference": "Western",
"wins": 64,
"losses": 18,
"conf_wins": 0,
"conf_losses": 0,
"home_wins": 34,
"home_losses": 8,
"away_wins": 30,
"away_losses": 10,
"points_for": 119,
"points_against": 107.9,
"avg_margin": 11.1,
"last10_wins": 7,
"win_pct": 0.78
},
{
"team_id": "24",
"abbrev": "SA",
"display_name": "San Antonio Spurs",
"conference": "Western",
"wins": 62,
"losses": 21,
"conf_wins": 0,
"conf_losses": 0,
"home_wins": 32,
"home_losses": 8,
"away_wins": 30,
"away_losses": 13,
"points_for": 119.7,
"points_against": 111.7,
"avg_margin": 8.1,
"last10_wins": 8,
"win_pct": 0.747
},
"...28 more"
],
"count": 30,
"note": "Regular season, final games only. conference is the team's current conference."
}What to do next
- get_team_stats (5 credits). Pace and efficiency behind each record.
- get_ratings (2 credits). Our team Elo ratings for a view that ignores schedule luck.
More guides
Start with 500 free credits every month
No card. REST or MCP.