skillfed

MLB-StatsAPI

MLB Stats API Wrapper for Python

mlb-statsapi v1.9.0 137.8K downloads/30d#11,354 on PyPI841
Copyleft license Active released

What it is and what it does

MLB-StatsAPI is a Python wrapper around MLB's public Stats API that lets you programmatically retrieve baseball data—games, scores, player stats, team information, and more. It abstracts away the HTTP details by wrapping requests, so you can focus on querying the data you need rather than building API calls manually.

The package is maintained actively with recent development and has a straightforward install with minimal dependencies. It's designed for developers building baseball-related applications, data analysis tools, or dashboards that need live or historical MLB information. Note that this is an unofficial wrapper; data usage is subject to MLB's terms, and the package is not affiliated with MLB or any MLB team.

Use it for:

  • Build a dashboard or web app that displays live MLB game scores and standings
  • Analyze historical player statistics or team performance across seasons
  • Create alerts or notifications for specific teams, players, or game outcomes
  • Populate a database with MLB data for research or fantasy baseball applications
  • Integrate MLB data into a sports news or stats aggregation tool

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python access to MLB's Stats API, allowing you to query baseball statistics, game data, player information, and other MLB-related data programmatically.

Yes, if you need programmatic access to MLB data. Low install friction, active maintenance, no known vulnerabilities, and a single lightweight dependency make it straightforward to adopt. The GPLv3 license requires that any derivative work also be open-source, so verify that aligns with your project's licensing model before committing.

Install

mlb-statsapi on PyPI

pip

pip install mlb-statsapi

uv

uv add mlb-statsapi

poetry

poetry add mlb-statsapi

Installing MLB-StatsAPI

Before you install

Low friction installation with a single runtime dependency (requests). Active maintenance with recent commits and steady development history since 2019-04-26.

License in practice

Licensed under GPLv3 (copyleft). Any derivative work or modification must also be released under GPLv3; redistribution requires source code availability.

Quickstart

pip install mlb-statsapi

import statsapi

# Fetch game data
games = statsapi.schedule(start_date='2025-04-04', end_date='2025-04-04')

Verify before relying

  • Whether the package supports querying historical data beyond the current season
  • Rate limiting or throttling behavior when making repeated API calls
  • Specific Python version compatibility (requires_python is unspecified)

Package facts

License not declared (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — requests
Maintenance actively maintained — 497 days since the last release
Last repo commit
First released
Downloads 137,837/month — #11,354 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mlb_statsapi-1.9.0-py3-none-any.whl

License :: OSI Approved :: GNU General Public License v3 (GPLv3)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3

Tags

MLB baseball statistics APIfetch MLB game data pythonbaseball stats wrapperMLB player statisticsbaseball data API client
sports-dataapi-wrapper

More WWW/HTTP packages