How do I get today's NBA schedule and scores in Python?
Every NBA game on a date with score, venue and attendance. October 10 had seven preseason games that averaged 227.7 total points.
Code verified November 18, 2026. One call to list_games, 2 credits.
The call
date is a US Eastern calendar day. Use from and to for a range, team for one club, season_type to pick preseason, regular or postseason, and status final or scheduled. get_schedule lists the next days. Pass league: "wnba" for the WNBA.
import requests
import pandas as pd
API_KEY = "YOUR_API_KEY"
resp = requests.post(
"https://mcp.dunkapi.com/v1/list_games",
headers={"x-api-key": API_KEY},
json={
"date": "2026-10-10",
},
timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
games = pd.json_normalize(data["games"])
games["margin"] = games["home.score"] - games["away.score"]
print(len(games), "games on", games["date"].iloc[0], "-", games["season_type"].iloc[0])
print(games[["status", "away.abbrev", "away.score", "home.abbrev", "home.score", "margin"]].to_string(index=False))
print("points per game:", round((games["home.score"] + games["away.score"]).mean(), 1))
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.
Or use the official client: pip install dunkapi
What comes back
The data object of the response, trimmed to the first rows. Every field is real output from the run above.
{
"games": [
{
"game_id": "401898720",
"season": 2027,
"season_type": "preseason",
"date": "2026-10-10",
"starts_at": "2026-10-11T02:30:00.000Z",
"status": "final",
"home": {
"team_id": "21",
"abbrev": "PHX",
"name": "Phoenix Suns",
"score": 102
},
"away": {
"team_id": "24",
"abbrev": "SA",
"name": "San Antonio Spurs",
"score": 98
},
"periods": 4,
"overtime_periods": 0,
"neutral_site": false,
"conference_game": false,
"venue": "Mortgage Matchup Center",
"city": "Phoenix",
"attendance": 17071
},
{
"game_id": "401898399",
"season": 2027,
"season_type": "preseason",
"date": "2026-10-10",
"starts_at": "2026-10-11T00:30:00.000Z",
"status": "final",
"home": {
"team_id": "9",
"abbrev": "GS",
"name": "Golden State Warriors",
"score": 111
},
"away": {
"team_id": "23",
"abbrev": "SAC",
"name": "Sacramento Kings",
"score": 106
},
"periods": 4,
"overtime_periods": 0,
"neutral_site": false,
"conference_game": false,
"venue": "Chase Center",
"city": "San Francisco",
"attendance": 18064
},
"...5 more"
],
"count": 7,
"next_offset": null
}What to do next
- get_schedule (2 credits). The next days of games, with consensus lines where posted.
- get_game (5 credits). The box score for one game from this list.
More guides
The same guide for other sports
- PuckAPI: How do I get today's NHL schedule and scores in Python?
- EndzoneAPI: How do I get NFL scores and the schedule for a week in Python?
- FighterAPI: How do I get the upcoming UFC fight schedule in Python?
- StrikerAPI: How do I get Premier League scores and fixtures in Python?
- AcesAPI: How do I get set-by-set tennis scores for a tournament in Python?
- BirdieAPI: How do I get the PGA Tour schedule in Python?
- FastballAPI: How do I get MLB scores and the schedule in Python?
Rather ask Claude? 19 free Claude skills call these endpoints for you.
Start with 500 free credits every month
No card. REST or MCP.