SportAPINBAGet SportAPI Key

Detroit Pistons

Coach
J.B. Bickerstaff
Arena
Little Caesars Arena
Conference
Eastern
8-3Record
3rdEastern
W2Streak

Roster

No.PlayerPosHtGPMinPtsRebAstFG%3P%
2Cade CunninghamG6-61134.625.05.27.948.531.4
55Duncan RobinsonF6-71131.818.11.92.245.543.7
24Daniss JenkinsG6-41127.413.53.84.346.244.4
0Jalen DurenC6-10219.013.07.52.058.8–
7Paul ReedF6-91127.111.57.72.356.455.6
20John CollinsF6-91126.310.65.90.749.041.4
9Ausar ThompsonG6-71028.710.18.75.049.40.0
27Kevin HuerterG6-61123.29.02.52.143.934.7
17Isaiah JoeG6-4313.77.31.71.036.823.1
31Javonte GreenG6-51117.46.12.30.539.630.0
5Ronald Holland IIF6-81115.44.93.51.734.528.0
23Ebuka OkorieG6-254.22.20.40.633.30.0
12Taurean PrinceF6-626.52.01.00.033.333.3
35Tolu SmithF6-1174.00.91.60.140.0–
13Isaac JonesC6-843.50.51.30.350.00.0
94Elijah HarklessG6-313.00.00.00.0––
34Ugonna OnyensoC7-00––––––

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 Detroit Pistons is 21 and the slug is detroit-pistons. /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/detroit-pistons", timeout=20).json()["data"]
print(team["name"], "- coach", team["coach_name"])

roster = session.get(f"{BASE}/teams/21/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/21/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:33 AM ET