Player & Team Stats
Access game-by-game player statistics and aggregate team/player stats
Player & Team Statistics
Access comprehensive player game logs and aggregate statistics with advanced filtering options for building analytics platforms and betting research tools.
Endpoints
GET /players/{id}/historicData
/players/{id}/historicDataRetrieve game-by-game statistics for a player. Returns every recorded game by default, or use the query params below to scope the result.
Query parameters (all optional):
| Parameter | Type | Description |
|---|---|---|
gamesBack | number | Limit to the player's most recent N completed games (events with a start time in the past). Counts distinct games, not stat rows. |
seasonType | string | Filter by season type (REG, PRE, POST). |
metric | string | One metric ID (METR_points) or a comma-separated list (METR_points,METR_assists). |
Example:
response = requests.get(
f"{base_url}/players/PLYR_abc123def456/historicData",
headers=headers,
params={
"gamesBack": 5,
"metric": "METR_points,METR_assists"
}
)
games = response.json()Response: a list of events (most recent first), each containing the stat rows recorded in that game:
[
{
"event": {
"id": "EVNT_xyz789abc012",
"sport": "Basketball",
"league": "NBA",
"name": "Los Angeles Lakers @ Miami Heat",
"nameSpecial": null,
"startTime": "2024-01-15T01:20:00Z"
},
"stats": [
{ "metric": { "id": "METR_points", "name": "Points" }, "value": 28.0 },
{ "metric": { "id": "METR_assists", "name": "Assists" }, "value": 10.0 }
]
}
]
gamesBackcounts games, not rowsA player typically has several stat rows per game (one per metric).
gamesBack=5returns the five most recent games with all of their matching stat rows, not five individual rows.
GET /teams/{id}/historicData
/teams/{id}/historicDataRetrieve game-by-game team statistics (from TeamGameData) for a team. Same query params and response shape as the player endpoint above, but each stats entry is a team-level metric for that game.
Team stats are currently available for NFL teams. A team with no team stats returns 404 with {"detail": "Historic team data for <team name> is not yet available"}; filters that match none of a team's games return [].
Query parameters (all optional): gamesBack, seasonType, metric (single or comma-separated) β identical semantics to /players/{id}/historicData.
Example:
response = requests.get(
f"{base_url}/teams/TEAM_7ab6eb241f3e440ab8c6d771fb0694a9/historicData",
headers=headers,
params={"gamesBack": 1, "metric": "METR_points,METR_touchdowns,METR_passyds"}
)
team_games = response.json()Response:
[
{
"event": {
"id": "EVNT_96fb3cfc9bd94a92b7e4016d0c20bad0",
"sport": "Football",
"league": "NFL",
"name": "Philadelphia Eagles @ Jacksonville Jaguars",
"nameSpecial": null,
"startTime": "2026-10-11T13:30:00Z"
},
"stats": [
{
"metric": {
"id": "METR_passyds",
"name": "Passing Yards"
},
"value": 220.0
},
{
"metric": {
"id": "METR_touchdowns",
"name": "Touchdowns"
},
"value": 2.0
},
{
"metric": {
"id": "METR_points",
"name": "Points"
},
"value": 17.0
}
]
}
]GET /players/historicData?team={team}
/players/historicData?team={team}Retrieve game logs for every player on a team's current roster in a single request. Players are resolved from the team's active roster spots at request time.
Query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
team | string | Yes | A team ID (TEAM_lakers) or the team's full name (case-insensitive, e.g. Los Angeles Lakers). |
gamesBack | number | No | Most recent N completed games per player. |
seasonType | string | No | REG, PRE, or POST. |
metric | string | No | One metric ID or a comma-separated list. |
Returns 400 if team is missing or a full name matches more than one team; 404 if no team matches.
Example:
response = requests.get(
f"{base_url}/players/historicData",
headers=headers,
params={
"team": "Los Angeles Lakers",
"gamesBack": 5,
"metric": "METR_points,METR_assists"
}
)
roster_logs = response.json()Response: a list with one entry per rostered player:
[
{
"player": {
"id": "PLYR_abc123def456",
"firstName": "LeBron",
"lastName": "James",
"fullName": "LeBron James",
"sportId": "SPRT_basketball",
"sportsdataioId": "20000571",
"oddsjamId": null,
"sportradarId": null
},
"historicData": [
{
"event": { "id": "EVNT_xyz789abc012", "sport": "Basketball", "league": "NBA", "name": "Lakers @ Heat", "nameSpecial": null, "startTime": "2024-01-15T01:20:00Z" },
"stats": [
{ "metric": { "id": "METR_points", "name": "Points" }, "value": 28.0 },
{ "metric": { "id": "METR_assists", "name": "Assists" }, "value": 10.0 }
]
}
]
}
]GET /events/{id}/historicData
/events/{id}/historicDataRetrieve the actual game-line stats for a completed event β i.e. what each player and team did in that single game.
This endpoint is only available for events that have already started (startTime in the past). Requesting it for an upcoming event returns 400; an unknown event ID returns 404.
Stats are available the morning after the event; until then players and teams are empty lists.
No query parameters.
Example:
response = requests.get(
f"{base_url}/events/EVNT_xyz789abc012/historicData",
headers=headers
)
event_stats = response.json()Response: an object with players and teams lists. Each entry pairs the entity with its stat lines for that game:
{
"players": [
{
"player": {
"id": "PLYR_abc123def456",
"firstName": "LeBron",
"lastName": "James",
"fullName": "LeBron James",
"sportId": "SPRT_basketball",
"sportsdataioId": "20000571",
"oddsjamId": null,
"sportradarId": null
},
"stats": [
{ "metric": { "id": "METR_points", "name": "Points" }, "value": 27.0 },
{ "metric": { "id": "METR_assists", "name": "Assists" }, "value": 8.0 }
]
}
],
"teams": [
{
"team": { "id": "TEAM_lakers", "name": "Lakers", "fullName": "Los Angeles Lakers", "abbr": "LAL" },
"stats": [
{ "metric": { "id": "METR_points", "name": "Points" }, "value": 110.0 }
]
}
]
}GET /marketSelections/{id}/historicData
/marketSelections/{id}/historicDataGet game-by-game statistics for the player/team in a specific market selection, with extensive filtering options.
Example:
response = requests.get(
f"{base_url}/marketSelections/MRKT_def456abc789/historicData",
headers=headers,
params={
"home": "true",
"gamesBack": 10
}
)
games = response.json()GET /marketSelections/{id}/metadata
/marketSelections/{id}/metadataAccess aggregate statistics (season averages, totals) for teams and players.
Example:
response = requests.get(
f"{base_url}/marketSelections/MRKT_def456abc789/metadata",
headers=headers,
params={
"playerAggStats": "true",
"teamAggStats": "true",
"playerAggStatsSeason": "2024,2023" # Multiple seasons
}
)
metadata = response.json()Player Game Logs
Basic Usage
Get all games for a player:
import requests
base_url = "https://api.sharpsports.io/v1"
headers = {"Authorization": "Token sk_test_your_key_here"}
player_id = "PLYR_abc123def456789012345678901234"
response = requests.get(
f"{base_url}/players/{player_id}/historicData",
headers=headers
)
games = response.json()
# Display recent games
for game in games[:10]:
date = game['event']['startTime']
name = game['event']['name']
# stats is a list of {metric, value} for that game
points = next((s['value'] for s in game['stats'] if s['metric']['id'] == 'METR_points'), None)
print(f"{date} β {name}: {points} pts")Response Structure
The endpoint returns a list of games (most recent first). Each game has an event object and a stats list, where every entry is a {metric, value} pair for that game:
[
{
"event": {
"id": "EVNT_xyz789abc012",
"sport": "Basketball",
"league": "NBA",
"name": "Los Angeles Lakers @ Miami Heat",
"nameSpecial": null,
"startTime": "2024-01-15T01:20:00Z"
},
"stats": [
{ "metric": { "id": "METR_points", "name": "Points" }, "value": 28.0 },
{ "metric": { "id": "METR_rebounds", "name": "Rebounds" }, "value": 7.0 },
{ "metric": { "id": "METR_assists", "name": "Assists" }, "value": 10.0 }
]
}
]
Use themetricquery param to limit which{metric, value}rows are returned (e.g.metric=METR_points,METR_assists).
Advanced Filtering
Use the /marketSelections/{id}/historicData endpoint for advanced filtering:
Home/Away Splits
# Get only home games
home_games = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"home": "true"}
).json()
# Get only away games
away_games = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"away": "true"}
).json()Recent Games
# Get last 10 games
recent = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"gamesBack": 10}
).json()
# Get last 5 games
last_five = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"gamesBack": 5}
).json()Opponent Filtering
# Games vs specific opponent
vs_opponent = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"opponent": "TEAM_celtics"}
).json()
# Games vs event opponent (upcoming game)
vs_next_opponent = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"vsOpponent": "true"}
).json()MLB Pitcher Filtering
# Games vs left-handed pitchers
vs_lhp = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"pitcher": "L"}
).json()
# Games vs right-handed pitchers
vs_rhp = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"pitcher": "R"}
).json()
# Games vs specific pitcher
vs_specific = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"pitcher": "PLYR_kershaw"}
).json()
# Games vs event starting pitcher
vs_event_pitcher = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={"vsStartingPitcher": "true"}
).json()Combining Filters
# Last 10 home games vs left-handed pitchers
filtered = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/historicData",
headers=headers,
params={
"home": "true",
"gamesBack": 10,
"pitcher": "L"
}
).json()Aggregate Statistics in /metadata
/metadata/marketSelections/{id}/metadata can attach season-level aggregate stats to the entities in its response. Each entry has the same shape as the standalone player aggregate stats and team aggregate stats endpoints; this section only covers the metadata params.
| Param | Adds aggregateStats to |
|---|---|
playerAggStats=true | player |
teamAggStats=true | event.contestantHome and event.contestantAway |
opposingPitcherAggStats=true | startingPitcher (MLB batter props only) |
aggregateStats is a list of season entries, most recent first. Pick seasons with playerAggStatsSeason / teamAggStatsSeason (comma-separated years).
metadata = requests.get(
f"{base_url}/marketSelections/{mrkt_id}/metadata",
headers=headers,
params={"playerAggStats": "true", "teamAggStats": "true"}
).json()
for season in metadata["player"]["aggregateStats"]:
passing_yards = season["stats"]["counting_stats"]["passing_yards"]
print(season["season"], passing_yards["per_game"]["value"])
home_team_stats = metadata["event"]["contestantHome"]["aggregateStats"]Response (trimmed to one stat each):
{
"player": {
"id": "PLYR_d469c8dee6bf40fe93b2a6b966cb97aa",
"fullName": "Jalen Hurts",
"aggregateStats": [
{
"season": "2026",
"team": null,
"position": "QB",
"games_played": 5,
"games_started": null,
"stats": {
"counting_stats": {
"passing_yards": {
"total": {
"value": 933,
"positional_rank": 23
},
"per_game": {
"value": 186.6,
"positional_rank": 29
},
"metric_id": "METR_passyds",
"rank_type": "high_to_low",
"metric_name": "Passing Yards",
"total_position_players": 50
}
}
}
}
]
},
"event": {
"contestantHome": {
"id": "TEAM_7ab6eb241f3e440ab8c6d771fb0694a9",
"fullName": "Philadelphia Eagles",
"aggregateStats": [
{
"season": "2026",
"stats": {
"general": {
"record": "2-3",
"point_differential": {
"rank": 26,
"value": -20.0,
"rank_type": "high_to_low"
}
}
}
}
]
}
}
}Stats that correspond to a Metric include its metric_id and metric_name.
Filtered Aggregate Stats
filteredPlayerAggStats, filteredTeamAggStats and filteredOpposingPitcherAggStats return the same aggregateStats entries in the same places, narrowed to the stats relevant to the market (e.g. passing stats for a passing yards prop) and, for MLB, to the matching home/away and handedness splits. They are season stats, so gamesBack, home/away and other game filters don't apply to them.
Available Statistics
Game stats (historicData endpoints). Every stats row returned by /players/{id}/historicData, /teams/{id}/historicData, /players/historicData, /events/{id}/historicData and /marketSelections/{id}/historicData is keyed by a Metric, e.g. {"metric": {"id": "METR_points", "name": "Points"}, "value": 24.0}. Use GET /metrics for the full list. Some common metrics:
- NBA / WNBA:
METR_points,METR_rebounds,METR_assists,METR_3ptfieldgoals - NFL:
METR_passyds,METR_rushyds,METR_recyds,METR_receptions,METR_touchdowns - MLB:
METR_hits,METR_homeruns,METR_rbis,METR_runs,METR_pitcherstrikeouts - NHL:
METR_goals,METR_assists,METR_points,METR_shotsongoal,METR_saves
Aggregate stats. Season aggregate stats (from the player and team aggregate stats endpoints, or /metadata as above) aren't keyed by Metric, though stats that match one include its metric_id. They are nested objects, usually split into counting_stats and efficiency_stats and, for some leagues, grouped by category (general, offensive, defensive, ...). Stat names vary by league and data source; call those endpoints to see what a league includes.
Query Parameters Reference
/players/{id}/historicData and /teams/{id}/historicData
/players/{id}/historicData and /teams/{id}/historicData| Parameter | Type | Description |
|---|---|---|
gamesBack | number | Limit to the most recent N completed games (counts distinct games, not stat rows) |
seasonType | string | Filter by season type (REG, PRE, POST) |
metric | string | One metric ID or a comma-separated list (e.g. METR_points,METR_assists) |
/players/historicData
/players/historicData| Parameter | Type | Required | Description |
|---|---|---|---|
team | string | Yes | Team ID or full name (case-insensitive) |
gamesBack | number | No | Most recent N completed games per player |
seasonType | string | No | Filter by season type (REG, PRE, POST) |
metric | string | No | One metric ID or a comma-separated list |
/events/{id}/historicData
/events/{id}/historicDataNo query parameters. Only available for events that have started (returns 400 for upcoming events); stats are available the morning after the event.
/marketSelections/{id}/historicData
/marketSelections/{id}/historicData| Parameter | Type | Description |
|---|---|---|
line | number | Line to calculate hit rates on. Optional: defaults to the consensus main line (the most common main line across books) |
home | boolean | Filter to home games only |
away | boolean | Filter to away games only |
location | string | Filter by venue, opponent, or location |
pitcher | string | MLB: Filter by pitcher hand (L/R) or pitcher ID |
opponent | string | Filter by opponent team ID |
vsOpponent | boolean | Filter to games vs event opponent |
vsStartingPitcher | boolean | MLB: Games vs event starting pitcher |
vsStartingPitcherHand | boolean | MLB: Games vs event pitcher hand |
gamesWithout | string | Filter to games without injured players |
winningMargin | number | Filter by winning margin threshold |
gamesBack | number | Limit to most recent N games or current season |
seasonType | string | Filter by season type (REG, PRE, POST) |
/marketSelections/{id}/metadata
/marketSelections/{id}/metadata| Parameter | Type | Description |
|---|---|---|
teamAggStats | boolean | Include team aggregate statistics |
filteredTeamAggStats | boolean | Include filtered team aggregate stats |
playerAggStats | boolean | Include player aggregate statistics |
filteredPlayerAggStats | boolean | Include filtered player aggregate stats |
teamAggStatsSeason | string | Comma-separated years for team stats |
playerAggStatsSeason | string | Comma-separated years for player stats |
opposingPitcherAggStats | boolean | MLB batter props: include the opposing starting pitcher's aggregate stats on startingPitcher |
filteredOpposingPitcherAggStats | boolean | Same, narrowed to the pitching stats relevant to the market and the batter's handedness split |
Note: filtered aggregate stats are narrowed to the stats relevant to the market (see Filtered Aggregate Stats); game filters like gamesBack and home/away don't apply to them.
Need Help?
- π§ Support: [email protected]
- π API Reference: /reference
- π¬ Discord: Join our developer community
Updated 13 days ago