Baseball · USA · 30 teams
MLB API with the live count, every at-bat and every pitch
An MLB API for live scores with the inning, the count, outs and runners on base, and for every at-bat and pitch with its Statcast type, speed and zone, on league id 201220. Umpire crews, ballpark weather and postseason series have endpoints of their own, and the seasons go back to 2003.
- Seasons since 2003
- 30 teams
- League id 201220
- Every pitch from Pro

MLB
GET /v2/leagues/201220
- League id
201220- Category
- USA
- Archive
- Seasons since 2003
- Teams
- 30 teams
- Live channel
league:201220
In the data
The MLB in the API
What league id 201220 holds, and how its seasons are laid out.
Seasons from 2003, and what sits apart
/v2/leagues/201220/seasons lists every MLB season from 2003 to 2027, newest first, and the league card dates the 2027 season from 25 March to 30 October. The tables rank clubs by winPercentage with gamesBehind, count runs as their scoreUnit and carry no draws column. The preseason, the All-Star Game and the summer camp are competitions of their own, named MLB, Preseason, MLB All Star Game and MLB Summer Camp, so their games stay out of these seasons.
The count, as the source sends it
While a game is on, the fixture's inningState holds the inning and its half (top or bottom), the count of balls and strikes, the outs, and a flag for each of the three bases. The source resends it about once a minute rather than after every pitch, so the count can trail the field by up to a minute; on Business and Enterprise each new state is pushed whole over the WebSocket. The score keeps the R/H/E line: runs per inning from period1, extra innings from period10 on, then hits and errors.
At-bats, pitches, umpires and weather
From Pro, /v2/fixtures/{id}/points lists every at-bat with inning, half, batter and pitcher, and the home side's chance of winning, as the source rates it, before and after the at-bat. An at-bat's id opens /v2/fixtures/{id}/at-bats/{atBatId}/pitches, where each pitch has its Statcast pitchType, speedKmh, zone and the count after it, and the last one carries the result. On every plan, /umpires names the crew by station and /weather gives the ballpark conditions in metric units, observed first, then the forecast.
Endpoints
The calls behind a MLB app
Each takes league id 201220, a season id from its seasons list, or a game or team id from those. Every row opens its page in the docs.
- GET
/v2/leagues/{id}/standingsStandingsClubs ranked on win percentage, with games behind the leader and runs scored and allowed.All plans - GET
/v2/leagues/{id}/calendarSeason calendarThe days of a season that have games, and how many on each.All plans - GET
/v2/fixtures/{id}FixtureOne game with its live inning state: inning, half, count, outs and bases.All plans - GET
/v2/fixtures/{id}/pointsPoint by pointThe game's plate appearances in order: inning, half, batter, pitcher and the source's home win chance.Pro and up - GET
/v2/fixtures/{id}/at-bats/{atBatId}/pitchesPitchesOne at-bat pitch by pitch: type, speed, zone, count and result.Pro and up - GET
/v2/fixtures/{id}/lineupsLineupsThe batting order and fielding positions, each player with a line for the game.All plans - GET
/v2/fixtures/{id}/umpiresUmpiresThe umpiring crew by station, with years of experience.All plans - GET
/v2/fixtures/{id}/weatherWeatherBallpark conditions in metric units, observed and forecast.All plans - GET
/v2/fixtures/{id}/seriesPlayoff seriesEvery game of a postseason series, from any one of its ids.All plans
First request
The MLB in three calls
Every call starts from the league id, 201220. The seasons list gives the season ids, newest first, and the season id is what the tables, rounds, leaderboards and statistics ask for.
The answers use the usual { data, meta } envelope and the same field names as every other baseball competition, so the code works unchanged for the next league you add.
# Every season, newest first, with its season id
curl "https://api.datasportsapi.com/v2/leagues/201220/seasons" \
-H "Authorization: Bearer $DATASPORTSAPI_API_KEY"
# The season's tables, by win percentage
curl "https://api.datasportsapi.com/v2/leagues/201220/standings?season={seasonId}&group=all" \
-H "Authorization: Bearer $DATASPORTSAPI_API_KEY"
# The days with games, and how many on each
curl "https://api.datasportsapi.com/v2/leagues/201220/calendar?season={seasonId}" \
-H "Authorization: Bearer $DATASPORTSAPI_API_KEY"{ "data": {
"id": 201220, "name": "MLB", "sport": "baseball",
"category": "USA",
…
} }History
How much of the MLB each plan reads
The archive goes back to 2003. Each plan reads back a set time from today; nothing live or upcoming is ever held back.
| Topic | History | What it covers of the MLB |
|---|---|---|
| Free | Last 7 days | Live and upcoming games, the table and statistics of a season still being played, and finished games from the last 7 days. |
| Starter | Last 30 days | Live and upcoming games, the table and statistics of a season still being played, and finished games from the last 30 days. |
| Pro | Last 6 months | Live and upcoming games, the table and statistics of a season still being played, and finished games from the last 6 months. |
| Business | Last 12 months | Live and upcoming games, the table and statistics of a season still being played, and finished games from the last 12 months. |
| Enterprise | Full history | The whole archive: seasons since 2003. |
Questions
MLB API, answered
Anything else? The full FAQ covers quota, plans and the data in general.
Does the MLB API have pitch-by-pitch data?
Yes, from Pro. Take an at-bat's id from /v2/fixtures/{id}/points and pass it to /v2/fixtures/{id}/at-bats/{atBatId}/pitches: each pitch comes with its Statcast type, its release speed in km/h (multiply by 0.6214 for mph), its zone, 1 to 9 inside the strike zone and 11 to 14 outside, and the balls, strikes and outs after it. Plays between pitches, such as a stolen-base attempt, appear as rows of kind steal.
Whose win probability comes with each at-bat?
The source's. homeWinProbabilityBefore and homeWinProbabilityAfter on each at-bat are its figures on a 0 to 100 scale, passed on as they come; they are neither our model nor bookmaker odds, and the away side's chance is 100 minus the home one.
Are the preseason and the All-Star Game included?
Yes, as competitions with ids and seasons of their own: MLB, Preseason from 2023, MLB All Star Game from 2020, and MLB Summer Camp. /v2/search?q=mlb&type=league lists them, each id ready for /v2/leagues/{id}, and because they sit apart, league 201220's tables count only its own games.
How far back does MLB data go?
To the 2003 season. How far back a key can read is set by its plan, counted back from today: Free 7 days, Starter 30 days, Pro 6 months, Business 12 months, and Enterprise the whole archive. Live and upcoming games, and the table and statistics of a season still being played, are open on every plan.
Can I follow MLB games live on the free plan?
Yes. Live and upcoming games are never held back by a plan, so a Free key follows every MLB game in play through /v2/livescores or /v2/fixtures/{id}, with score, status and clock current to the second, within the plan's request quota. On Business and Enterprise, the WebSocket channel league:201220 pushes every change instead.
Keep reading
Other competitions
Premier League APILeague id 195828: live scores, the table, xG and every season since 1992/93.
Champions League APILeague id 4409: the 36-club league phase, the knockout bracket and every season since 1992/93.
La Liga APILeague id 4408: Spain's top flight, head-to-head records and every season since 1969/70.
Serie A APILeague id 195910: Italy's top flight, venues and the longest big-five archive, back to 1965/66.
Bundesliga APILeague id 195937: Germany's 18 clubs, the team of the week and every season since 1970/71.
Ligue 1 APILeague id 195793: France's top flight, every player's statistics and seasons since 1970/71.
World Cup APILeague id 195843: all 23 tournaments from 1930 to 2026, group tables and the bracket.
NBA APILeague id 198277: box scores, play-by-play, shot charts, the draft and live player tracking.
NFL APILeague id 201295: down and distance live, win probability, the draft and seasons back to 1920.
NHL APILeague id 201302: conference and division tables, shot maps by strength, the three stars and playoff series.
IPL APILeague id 195830: full scorecards, every ball with wagon wheel and pitch map, and seasons since 2013.
Süper Lig APILeague id 172801: Turkey's top division, its referees on record and seasons back to 1980/81.
MLS APILeague id 6540: 30 clubs, two conference tables and calendar-year seasons since 2008.
Europa League APILeague id 43443: one 36-club table, knockout ties on aggregate and seasons since 2009/10.
Everything in the baseball data Sports statistics API Live scores API
Build on the MLB today.
1,000 free requests a day during the beta. No card, no sales call.