Skip to main content

SportsDataHQ for Python

One package for nine sports data APIs: NBA, NFL, NHL, MLB, soccer, tennis, golf, MMA and cricket. Schedules, scores, player stats, standings, ratings, sportsbook lines and player props, as plain dicts or pandas DataFrames.

No required dependencies (standard library only), Python 3.9 and newer. Every call goes to the live API with your own key; the package ships no data.

60-second quickstart

pip install "sportsdatahq[pandas]"
import sportsdatahq as sdhq

sdhq.login()          # once: opens the free signup page, you paste the key, it is saved for next time

client = sdhq.Client()

# NFL passing-yard props for one game, by sportsbook, as a DataFrame (10 credits)
props = client.nfl.player_props("2025_01_KC_LAC", "player_pass_yds", bookmaker="draftkings")
print(props.df("props")[["player_name", "line", "over_odds", "under_odds"]])

# NBA scores for a date (2 credits)
for g in client.nba.games(date="2026-03-15", limit=3)["games"]:
    print(g["away"]["abbrev"], g["away"]["score"], "at", g["home"]["abbrev"], g["home"]["score"])

print("credits left:", client.last_credits_remaining)

Get a free key: https://app.sportsdatahq.com/signup?utm_source=pypi&utm_medium=sportsdatahq&utm_campaign=readme. A SportsDataHQ key works for every sport, with 1,000 free credits a month and no card.

Keys

login() saves the key to ~/.config/sportsdatahq/config.json, readable only by you (mode 600). You can also set it yourself:

export SDHQ_API_KEY=sk_sdhq_...

Already have a key from one of the sport APIs (DunkAPI, EndzoneAPI, PuckAPI and so on)? It keeps working for its own sport:

client = sdhq.Client(keys={"nba": "sk_live_...", "nfl": "sk_live_..."})

or through its usual variable (DUNKAPI_API_KEY, ENDZONEAPI_API_KEY, ...). sdhq.login("nba") saves a brand key for one sport. For each sport, the first key found wins:

  1. Client(keys={"nba": ...})
  2. Client(api_key=...)
  3. SDHQ_API_KEY
  4. the sport's own variable, such as DUNKAPI_API_KEY (or DUNKAPI_KEY)
  5. the saved config file

A sport's key is looked up the first time you use that sport, so a script that only touches the NBA never needs an NFL key. If a sport has no key, the error names the page where you get one.

Sport Attribute API Brand key variable
NBA, WNBA, college basketball client.nba DunkAPI DUNKAPI_API_KEY
NFL client.nfl EndzoneAPI ENDZONEAPI_API_KEY
NHL and other hockey leagues client.nhl PuckAPI PUCKAPI_API_KEY
MLB, college baseball client.mlb FastballAPI FASTBALLAPI_API_KEY
Soccer (17 leagues) client.soccer StrikerAPI STRIKERAPI_API_KEY
Tennis (ATP, WTA) client.tennis AcesAPI ACESAPI_API_KEY
Golf (PGA Tour, LPGA, LIV, DP World, Korn Ferry) client.golf BirdieAPI BIRDIEAPI_API_KEY
MMA (UFC, PFL, Bellator) client.mma FighterAPI FIGHTERAPI_API_KEY
Cricket client.cricket YorkerAPI YORKERAPI_API_KEY

The core functions

The same names work on every sport. Each maps to one API tool; credits are per call.

Function NBA NFL NHL MLB Soccer Tennis Golf MMA Cricket Credits
teams() list_teams list_teams list_teams list_teams list_teams - - - list_teams 1
find_player(name) search_players search_players search_players search_players search_players search_players search_players search_fighters search_players 1-2
schedule() get_schedule get_schedule get_schedule get_schedule get_schedule get_schedule get_schedule get_schedule get_schedule 1-2
games(...) list_games get_games get_games get_games list_games get_matches list_tournaments list_events get_matches 1-5
standings() get_standings get_standings get_standings get_standings get_standings get_rankings - - - 2
player(id) get_player get_player_stats get_player_stats get_player get_player get_player get_player get_fighter get_player 5
player_games(id) get_player_games get_player_stats get_player_game_log get_player_games get_player_games get_player_matches get_player_results get_fighter_fights get_player_matches 5
leaders(stat) get_leaders get_player_leaders get_skater_season_stats get_leaders get_leaders - get_leaders get_leaders get_leaders 5
odds(game_id) get_odds get_odds get_odds get_odds get_odds get_odds get_winner_odds get_odds get_odds 5-10
player_props(game_id, market) get_player_props get_player_props get_player_props get_player_props get_player_props - - - - 10
prop_history(player_id, market) get_prop_history get_prop_history get_prop_history get_prop_history get_prop_history - - - - 10
ratings() get_ratings - - get_ratings get_ratings get_ratings get_ratings get_ratings get_ratings 2

A - raises NotSupportedError. client.nba.cost("odds") gives a call's price from the spec. Filters are keyword arguments with the API's names (season=, team=, league="wnba", limit=); a Python keyword takes a trailing underscore (from_="2026-03-01").

Every API tool is also a method with its full signature and docstring, so nothing is hidden behind the helpers:

client.nhl.get_shifts(game_id="2026020080", team="TOR")
client.nba.get_shot_chart(player_id="...", season=2026)
client.soccer.call("get_lineups", {"game_id": "..."})   # any tool by name, including ones newer than this package
help(client.nfl.get_plays)

DataFrames

Results are plain dicts and lists. .df() turns the main list into a pandas DataFrame, with nested fields as dotted columns:

games = client.mlb.games(date="2026-07-04")
df = games.df()               # the longest list of records in the response
df = games.df("games")        # or name it
df = sdhq.to_dataframe(games, key="games")

pandas is optional: pip install "sportsdatahq[pandas]".

Credits and errors

After each call, client.last_credits_used and client.last_credits_remaining hold the counters from the response headers. Several tools take estimate_only=True to price a call without running it.

Exception When
MissingKeyError No key for that sport. The message has the signup link.
AuthError 401: the key is wrong or revoked.
InsufficientCredits 402: not enough credits. Has .required, .available, .refill_on and .upgrade_url.
PaidPlanRequired 403: a paid-plan tool on a free account.
NotFoundError 404: the id does not exist.
RateLimitError 429 after retries. Has .retry_after.
NotSupportedError The sport has no tool for that helper.
APIError Any other error. Every exception above is one.
try:
    client.nba.player_props("401810726", "player_points")
except sdhq.InsufficientCredits as e:
    print(e.message, e.upgrade_url)

429 and 5xx responses and dropped connections are retried up to 3 times with backoff (Client(max_retries=0) turns that off).

Data rights

Calls are live. You may store what you pull, build models and products on it, and show your users what you derive. You may not redistribute the data, or odds as a raw feed, as a dataset or API of its own. Full terms: https://app.sportsdatahq.com/terms. Sportsbook lines are information about the market, not betting advice.

License

MIT

Metadata

Release files for sportsdatahq 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sportsdatahq 0.1.0
File Size Uploaded Provenance Actions
sportsdatahq-0.1.0.tar.gz 73.7 kB With provenance Details for sportsdatahq-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sportsdatahq 0.1.0
File Interpreter ABI Platform Actions
sportsdatahq-0.1.0-py3-none-any.whl Python 3 none any Details for sportsdatahq-0.1.0-py3-none-any.whl

Total release size: 154.9 kB

Release files / sportsdatahq-0.1.0.tar.gz

Download URL sportsdatahq-0.1.0.tar.gz
Size 73.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cf59788d4362ea672db78d5228eb3e29129bc1c0007c7335d7c624b3150765ea
BLAKE2b-256 checksum
How to use checksums
d06b1be65314844c4424a37e30587d4174dc4e7ea9efd6151d4b99dc394ab7e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / sportsdatahq-0.1.0-py3-none-any.whl

Download URL sportsdatahq-0.1.0-py3-none-any.whl
Size 81.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf4aafe6320bb285a8d880ef54e50f9f667ffa2d0ea4b2b94eafa417b1239faf
BLAKE2b-256 checksum
How to use checksums
88774c08ed55016518ae3156d870a68b55ec15a32b62d83ac1572e3a248a9c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for sportsdatahq 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sportsdatahq-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page