Major League Baseball Stats API

Operations pertaining to stats

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).
Business capability
Sports, Betting & Fantasy AE-180.80

Operations 9

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

0 of 9 operations are conformant: apis.io called them with no credentials and the responses matched this contract; 1 more answered but could not be checked against a schema. Checked 2026-11-12. how this works · status file

GET /api/v1/stats Get player and team stats · View stats #
Ask an LLM
“How do I get a player's batting average for a season?”
“Can I get team stats grouped by game type?”
Tell an agent
Get {stats} stats for player {personId} in {group} for {season}.
Get {stats} stats for team {teamId} in {group} for {season}.
GET /api/v1/stats/search Search plays by event or pitch · View stats from search #
Ask an LLM
“Can I find every home run hit by a right-handed batter?”
“Which pitches were thrown at a certain exit velocity?”
Tell an agent
Search plays with event type {eventTypes} in {group}.
Find pitches thrown by {pitcherIds} with exit velocity against {maxExitVelocityAgainst}.
GET /api/v1/stats/metrics Get a player's metric stats · View metric stats #
Ask an LLM
“What is a player's exit velocity and launch angle for a season?”
“Can I get a pitcher's spin rate metrics?”
Tell an agent
Get {metrics} metrics for player {personId} in {group} for {season}.
Show {metrics} stats for batter {batterId} in {stats}.
GET /api/v1/stats/leaders Get leaders for a stat · Get leaders for a statistic observed #
Ask an LLM
“Who leads the league in home runs this season?”
“Can I get the top leaders for a stat by game type?”
Tell an agent
Get the leaders for {leaderCategories} in {statGroup} for {season}.
Show top {limit} leaders for {stats} by game type {leaderGameTypes}.
GET /api/v1/stats/grouped Get grouped baseball stats · View stats #
Ask an LLM
“How do I get a player's batting average against a certain pitcher?”
“Can I see a team's stats split by opponent?”
Tell an agent
Get {stats} stats for player {personId} grouped by {group}.
Show {stats} stats for team {teamId} against opponent {opposingTeamId}, split by {group}.
GET /api/v1/stats/analytics/stolenBaseProbability Get stolen base probability for a play · Get the probability of a hit for the given hit data #
Ask an LLM
“What is the probability a runner stole a base in a given play?”
“Can I get stolen base probability for a timecode in a game?”
Tell an agent
Get stolen base probability for play {gamePk}.
Calculate stolen base probability for timecode {timecode} in game {gamePk}.
GET /api/v1/stats/analytics/sprayChart Get a batter's spray chart · Get the spray chart info for the current batter #
Ask an LLM
“Where does a batter hit the ball most often?”
“Can I get a spray chart for a batter in a game?”
Tell an agent
Get the spray chart for batter {gamePk}.
Show spray chart for batter {gamePk} with fields {fields}.
GET /api/v1/stats/analytics/outsAboveAverage Get outs above average for a play · Get the spray chart info for the current batter #
Ask an LLM
“How many outs above average did a batter produce in a game?”
“Can I get outs above average for a timecode?”
Tell an agent
Get outs above average for play {gamePk}.
Calculate outs above average for timecode {timecode} in game {gamePk}.
GET /api/v1/stats/analytics/homeRunBallparkCount Count home runs hit at a ballpark · Get the probability of a hit for the given hit data #
Ask an LLM
“How many home runs were hit at a ballpark for a given spray angle and distance?”
“Can I get home run counts for a ballpark in a season?”
Tell an agent
Count home runs at ballpark {venueId} for spray angle {sprayAngle} and distance {distance}.
Get home run counts at {venueId} for {sprayAngle}, {distance} and home run {isHomeRun} in {season}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/major-league-baseball:major-league-baseball-stats-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

major-league-baseball-stats-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Documentation Stats API
  description: Official API for Major League Baseball.
  version: 2.0.0
servers:
- url: https://statsapi.mlb.com
  description: Production
- url: https://beta-statsapi.mlb.com
  description: Beta
- url: https://qa-statsapi.mlb.com
  description: QA
- url: http://localhost:8080
  description: Local
tags:


# --- truncated at 32 KB (288 KB total) ---
# Full source: https://artifacts.apis.io/major-league-baseball/openapi/major-league-baseball-stats-api-openapi.yml