SportAPINBAGet SportAPI Key

Phoenix Suns

Coach
Jordan Ott
Arena
Mortgage Matchup Center
Conference
Western
5-6Record
11thWestern
W2Streak

Roster

No.PlayerPosHtGPMinPtsRebAstFG%3P%
15Devin BookerG6-51133.925.52.55.049.537.5
3Dillon BrooksF6-71129.814.93.82.144.543.1
22Miles BridgesF6-71129.814.67.33.144.430.6
4Jalen GreenG6-41127.211.83.43.141.927.0
23Jordan GoodwinG6-3718.99.03.62.344.245.9
8Luke KennardG6-51017.08.31.31.851.843.2
12Collin GillespieG6-11124.57.72.24.134.131.9
10Khaman MaluachC7-21119.57.76.01.460.728.6
11Oso IghodaroF6-11922.26.05.23.657.1–
0Ryan DunnF6-71116.95.33.91.247.847.4
26Duop ReathC6-965.53.21.00.058.337.5
17Jamaree BouyeaG6-265.33.20.51.5100.0100.0
18Koa PeatF6-864.52.50.70.254.5–
20Rasheer FlemingF6-949.01.81.50.020.020.0
61Pat SpencerG6-244.51.31.31.333.350.0
2Drew TimmeF6-100––––––
25Mark WilliamsC7-10––––––

Per-game averages in the NBA regular season so far. Players without a game have dashes.

Get this team's data from the API

The team ID of the Phoenix Suns is 6 and the slug is phoenix-suns. /api/basketball/teams/slug/{slug} returns the coach, the arena, the standing and the latest and next games. The roster is at /api/basketball/teams/{id}/roster and every game of the team at /api/basketball/teams/{id}/games, newest first. The averages in the roster table on this page come from each player's profile at /api/basketball/players/slug/{slug}.

team.py
import requests

API_KEY = "YOUR_API_KEY"
session = requests.Session()
session.headers["X-API-Key"] = API_KEY
BASE = "https://sportapi.ai/api/basketball"

team = session.get(f"{BASE}/teams/slug/phoenix-suns", timeout=20).json()["data"]
print(team["name"], "- coach", team["coach_name"])

roster = session.get(f"{BASE}/teams/6/roster", timeout=20).json()["data"]
for p in roster:
    print(p["jersey"], p["name"], p["position"], p["height_cm"], "cm")

games = session.get(f"{BASE}/teams/6/games", params={"league": "nba", "limit": 5}, timeout=20).json()["data"]
for g in games:
    print(g["start"], g["away"]["abbreviation"], "@", g["home"]["abbreviation"], g["status"])

The API documentation lists every basketball endpoint. The same key works for the NBA, WNBA, EuroLeague, NCAA and the other leagues, and for football too.

Updated Nov 13, 11:59 AM ET