SportAPINBAGet SportAPI Key

Charlotte Hornets

Coach
Charles Lee
Arena
Spectrum Center
Conference
Eastern
4-8Record
10thEastern
L1Streak

Roster

No.PlayerPosHtGPMinPtsRebAstFG%3P%
24Brandon MillerF6-71031.020.64.92.235.626.0
0Naz ReidC6-91229.917.38.52.240.435.4
8Grayson AllenG6-31227.115.22.93.346.147.2
2Grant WilliamsF6-7116.011.02.01.060.050.0
17Dennis SchroderG6-1930.010.23.64.836.820.0
3Coby WhiteG6-4518.09.82.43.431.514.8
14Moussa DiabateF6-101029.08.79.52.162.1–
31Tidjane SalaunF6-101115.26.53.50.145.337.8
4Sion JamesG6-51226.16.03.42.932.925.9
00Royce O'NealeF6-61219.45.33.20.735.630.2
11Ryan KalkbrennerC7-11218.44.65.41.570.0–
5Christian AndersonG6-11112.94.31.51.734.025.0
33Liam McNeeleyG6-7610.33.81.70.829.225.0
7Kon KnueppelG6-616.03.00.00.00.00.0
22Hannes SteinbachF6-10512.62.84.00.643.8–
16PJ HallC6-826.00.01.01.50.00.0
18Kylan BoswellG6-10––––––
10Michael AjayiF6-70––––––

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 Charlotte Hornets is 14 and the slug is charlotte-hornets. /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/charlotte-hornets", timeout=20).json()["data"]
print(team["name"], "- coach", team["coach_name"])

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