StatMuse APIstatmuse.com ↗
Query NBA, NFL, MLB, and NHL player and team statistics using natural language via the StatMuse API. Get structured stat tables, answers, and search suggestions.
What is the StatMuse API?
The StatMuse API exposes 4 endpoints for querying sports statistics across NBA, NFL, MLB, NHL, and other leagues using natural language. The ask endpoint accepts any sports question in plain English and returns a text answer alongside structured stat tables. Player-focused requests go through get_player_stats, which accepts a player name and optional timeframe and delivers aggregated or game-by-game rows. Autocomplete support is available via search_suggestions.
curl -X GET 'https://api.parse.bot/scraper/6546515f-73d6-44cc-b3e2-2cafc0b022b1/get_player_stats?timeframe=last+10+games&player_name=LeBron+James' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace statmuse-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: StatMuse SDK — ask sports questions, get structured stats."""
from parse_apis.statmuse_api import StatMuse, QueryFailed
client = StatMuse()
# Ask a general sports trivia question — returns a typed Answer.
answer = client.answers.ask(query="Who has the most points in NBA history?")
print(f"Q: {answer.query}")
print(f"A: {answer.answer}")
# Access structured stat tables from the answer.
for table in answer.tables:
print(f" Table: {table.title}, rows: {len(table.rows)}")
# Get a specific player's recent game log.
player_answer = client.answers.player_stats(player_name="Stephen Curry", timeframe="last 5 games")
print(f"\nPlayer query: {player_answer.query}")
print(f"Summary: {player_answer.answer}")
if player_answer.tables:
first_row = player_answer.tables[0].rows[0]
print(f" First game: {first_row}")
# Get team info with a custom query type.
team_answer = client.answers.team_info(team_name="Lakers", query_type="historical record")
print(f"\nTeam query: {team_answer.query}")
print(f"Summary: {team_answer.answer}")
# Typed error handling — catch QueryFailed for bad queries.
try:
client.answers.ask(query="xyznonexistent player stats career")
except QueryFailed as exc:
print(f"\nQuery failed: {exc}")
# Autocomplete suggestions — discover players/teams before querying.
for section in client.suggestions.search(query="Giannis", limit=5):
print(f"\nSection type: {section.type}")
for s in section.suggestions:
print(f" {s.display} ({s.league}, {s.type})")
print("\nExercised: answers.ask / answers.player_stats / answers.team_info / suggestions.search")
Get detailed player statistics by providing a player name and optional timeframe. Constructs a natural language query internally and returns the answer with game-by-game or aggregated statistical tables. The timeframe is flexible natural language (e.g., 'last 10 games', '2024-25 season', 'career').
| Param | Type | Description |
|---|---|---|
| timeframe | string | Timeframe for stats (e.g., 'last 10 games', '2024-25 season', 'career') |
| player_namerequired | string | Full name of the player (e.g., 'LeBron James', 'Stephen Curry') |
{
"type": "object",
"fields": {
"url": "string — the StatMuse permalink URL for this query",
"query": "string — the constructed query sent to StatMuse",
"answer": "string — natural language answer summary",
"tables": "array of objects, each with 'title' (string) and 'rows' (array of stat row objects with column-name keys)"
},
"sample": {
"data": {
"url": "https://www.statmuse.com/ask?query=LeBron+James+stats+last+10+games",
"query": "LeBron James stats last 10 games",
"answer": "LeBron Jameshas averaged 23.2 points, 7.3 assists and 6.7 rebounds in 10 games in his last 10 games.",
"tables": [
{
"rows": [
{
"TM": "LAL",
"AST": "13",
"OPP": "HOU",
"PTS": "19",
"REB": "8",
"DATE": "4/18/2026",
"NAME": "LeBron James"
}
],
"title": "Results"
}
]
},
"status": "success"
}
}About the StatMuse API
Endpoints and What They Return
The ask endpoint is the most flexible entry point: pass any query string — for example, "Who has the most points in NBA history?" — and receive an answer string summarizing the result plus a tables array. Each table object carries a title and a rows array of stat row objects whose columns depend on the query. The url field in every response links back to the corresponding StatMuse page.
get_player_stats narrows the focus to a single athlete. Supply player_name as a required input and optionally pass a timeframe value such as 'last 10 games', '2023-24 season', or 'career'. The endpoint constructs a natural language query internally, visible in the query field of the response, and returns the same answer + tables structure. Rows in the tables reflect whatever statistical columns StatMuse surfaces for that player and timeframe.
Team Data and Search Suggestions
get_team_info works similarly to the player endpoint but targets franchises. Pass a team_name (e.g., 'Golden State Warriors') and an optional query_type such as 'stats last 10 games', 'historical record', or 'roster'. The response shape is identical — url, query, answer, and tables — making it straightforward to handle player and team responses with the same parsing logic.
search_suggestions accepts a partial query string and returns a sections array. Each section has a type field and a suggestions array where each item includes display text, image_url, league, and type. This is useful for building typeahead UIs or resolving ambiguous team and player names before sending a full query.
The StatMuse API is a managed, monitored endpoint for statmuse.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when statmuse.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official statmuse.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a fantasy sports assistant that fetches per-player stat tables for any timeframe using
get_player_stats - Power a sports chatbot that answers arbitrary fan questions by passing free-text queries to the
askendpoint - Populate a team dashboard with recent game logs via
get_team_infowithquery_typeset to 'stats last 10 games' - Implement autocomplete in a sports search bar using
search_suggestionswithleagueandtypefields for categorization - Pull career statistics for historical player comparisons using the
timeframe: 'career'parameter - Retrieve roster snapshots for any franchise by setting
query_typeto 'roster' inget_team_info - Aggregate cross-sport statistical trivia answers by querying the
askendpoint across NBA, NFL, MLB, and NHL subjects
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does StatMuse have an official developer API?+
What does the `tables` field in the response actually contain?+
tables array has a title string describing what the table covers and a rows array of stat row objects. The specific keys in each row depend on the query — for example, a game-log query will include per-game columns like points, assists, and rebounds, while a career query may return season-by-season aggregates.Does the API return play-by-play data or live game scores?+
Can I filter `get_player_stats` results by specific statistical categories, such as only three-point shooting?+
timeframe input and the natural language query that gets constructed from it. The columns returned in rows reflect what StatMuse includes for that query. You can fork the API on Parse and revise the query construction logic to target more specific statistical breakdowns.