API-Baseball
App · Sports · 15 actions
Follow baseball with API-Baseball: games and live scores by inning, standings, team season statistics, head-to-head records and bookmakers' pre-match odds, for MLB, Japan's NPB, Korea's KBO, Taiwan's CPBL, winter leagues and international cups. Needs an API-SPORTS key; the free plan allows 100 requests a day.
Actions
| Action | What it does |
|---|---|
| Find leagues and cups | Find baseball competitions by name, country, season or type, each with its ID, logo, country and every season on file with its dates. |
| Find teams | Find teams by name, by league and season, by country or by ID, each with its logo and country. |
| Get a game | Get one game by ID: its start time, status, and both sides' runs by inning, hits and errors, live while it is being played. |
| Get account status | See the connected key's API-Baseball plan, when it renews, and how many of today's requests are used and left. |
| Get pre-match odds | Get bookmakers' pre-match odds for a game, or for a league's games in a season, optionally from one bookmaker or for one bet type. |
| Get standings | Get a season's tables, such as MLB's two leagues, six divisions and overall table: each team's place, games played, won and lost with its win percentage, runs scored and allowed, and form. |
| Get team statistics | Get a team's season in one competition: games played, won and lost at home, away and in all, with win percentages, and runs scored and allowed in total and per game. |
| List bet types | List the kinds of bet API-Baseball has odds for, such as Home/Away or Over/Under, with the IDs the odds filter takes. |
| List bookmakers | List the bookmakers API-Baseball has odds from, with the IDs the odds filter takes. |
| List countries | List the countries and regions that have baseball competitions in API-Baseball, each with its ID, code and flag. |
| List games | List games and results by day, by league and season, or by team, live ones included, each with its start time, status, and both sides' runs by inning, hits and errors. |
| List head-to-head games | List the games two teams have played each other, in every season or only one league, season or day, with a count of each side's wins and runs across the finished ones. |
| List seasons | List the seasons API-Baseball has data for, oldest first, as the four-digit years the Season fields take. |
| List standings groups | List the tables a competition's season has, such as MLB's American League, its divisions and the overall MLB table, by the names Get standings takes as its Group. |
| List standings stages | List the named stages of a competition's season, such as a regular season and playoffs, which Get standings can narrow to. |
Find leagues and cups
Find baseball competitions by name, country, season or type, each with its ID, logo, country and every season on file with its dates. With no filter it lists all of them.
Inputs
- League
league_idtext - Optional. Only this competition. Pick one from the list, or pass a league ID such as 1 for MLB.
- Search
searchtext - Optional. Only names containing this, at least 3 characters.
- Country
countrytext - Optional. Only this country, by name as the list gives it, such as USA, Japan or South-Korea.
- Season
seasonnumber - Optional. Only this season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Type
league_typetext - Optional. Only leagues, or only cups.One of:
league,cup.
Outputs
countnumber- How many came back.
leagueslist- The competitions.
Example output
{
"count": 1,
"leagues": [
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"current_season": {
"current": true,
"end": "2026-10-07",
"season": 2026,
"start": "2026-03-26"
},
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"seasons": [
{
"current": false,
"end": "2024-10-31",
"season": 2024,
"start": "2024-02-22"
},
{
"current": false,
"end": "2025-11-01",
"season": 2025,
"start": "2025-03-18"
},
{
"current": true,
"end": "2026-10-07",
"season": 2026,
"start": "2026-03-26"
}
],
"type": "League"
}
]
}Find teams
Find teams by name, by league and season, by country or by ID, each with its logo and country. A league's teams can include its All-Star sides, such as MLB's American League and National League.
Inputs
- Team ID
team_idtext - Optional. Only this team, by ID, such as 25 for the New York Yankees.
- Search
searchtext - Optional. Only names containing this, at least 3 characters.
- League
league_idtext - Optional. Only this competition. Pick one from the list, or pass a league ID such as 1 for MLB.
- Season
seasonnumber - Optional. Only this season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Country
countrytext - Optional. Only this country, by name as the list gives it, such as USA, Japan or South-Korea.
Outputs
countnumber- How many came back.
teamslist- The teams.
Example output
{
"count": 1,
"teams": [
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees",
"national": false
}
]
}Get a game
Get one game by ID: its start time, status, and both sides' runs by inning, hits and errors, live while it is being played.
Inputs
- Game ID
game_idtextRequired - The game's ID, such as 153646. List games returns them.
- Time zone
timezonetext - Optional. Give dates and times in this time zone, such as America/New_York or Asia/Tokyo. UTC when left empty.
Outputs
countryobject- A country, or a region such as World for international competitions.
datetext- When it starts, with the time zone's offset (ISO 8601).
idnumber- The game's ID.
leagueobject- The competition, and the season this is from.
scoresobject- Both sides' scores.
statusobject- Where the game stands.
teamsobject- Both sides.
timetext- Its start time, HH:MM, in that time zone.
timestampnumber- When it starts, as a Unix timestamp.
timezonetext- The time zone date and time are given in.
weektext- The playoff round, such as Quarter-finals or Final; null in the regular season.
Example output
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"date": "2024-04-28T18:10:00+00:00",
"id": 153646,
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"scores": {
"away": {
"errors": 0,
"extra": null,
"hits": 18,
"innings": [
1,
0,
0,
0,
3,
7,
2,
2,
0
],
"total": 15
},
"home": {
"errors": 0,
"extra": null,
"hits": 11,
"innings": [
0,
0,
0,
0,
4,
1,
0,
0,
0
],
"total": 5
}
},
"status": {
"long": "Finished",
"short": "FT"
},
"teams": {
"away": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
},
"home": {
"id": 20,
"logo": "https://media.api-sports.io/baseball/teams/20.png",
"name": "Milwaukee Brewers"
}
},
"time": "18:10",
"timestamp": 1714327800,
"timezone": "UTC",
"week": null
}Get account status
See the connected key's API-Baseball plan, when it renews, and how many of today's requests are used and left. It is free: it never counts against the day.
Inputs
None.
Outputs
activetrue/false- True while the subscription is active.
daily_limitnumber- Requests allowed a day.
plantext- The plan, such as Free.
requests_remainingnumber- Requests left today; the day starts at midnight UTC.
requests_todaynumber- Requests used today.
subscription_endtext- When the plan renews or ends.
Example output
{
"active": true,
"daily_limit": 100,
"plan": "Free",
"requests_remaining": 88,
"requests_today": 12,
"subscription_end": "2027-10-01T00:00:00+00:00"
}Get pre-match odds
Get bookmakers' pre-match odds for a game, or for a league's games in a season, optionally from one bookmaker or for one bet type. Odds appear 1 to 7 days before a game, are updated once a day and are kept for 7 days after it.
Inputs
- Game ID
game_idtext - Optional. Only this game's odds. Set this, or a league and a season.
- League
league_idtext - Optional. Only this competition. Pick one from the list, or pass a league ID such as 1 for MLB.
- Season
seasonnumber - Optional. Only this season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Bookmaker
bookmaker_idtext - Optional. Only this bookmaker's odds. Pick one from the list.
- Bet type
bet_idtext - Optional. Only this kind of bet, such as Home/Away. Pick one from the list.
Outputs
countnumber- How many came back.
oddslist- Each game's odds.
Example output
{
"count": 1,
"odds": [
{
"bookmakers": [
{
"bets": [
{
"id": 1,
"name": "Home/Away",
"values": [
{
"odd": 1.95,
"value": "Home"
},
{
"odd": 1.86,
"value": "Away"
}
]
}
],
"id": 2,
"name": "Bet365"
}
],
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"game": {
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"date": "2026-10-02T00:00:00+00:00",
"id": 189823,
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2026,
"type": "League"
},
"scores": {
"away": {
"errors": 0,
"extra": null,
"hits": 1,
"innings": [
0,
0,
0,
0,
null,
null,
null,
null,
null
],
"total": 0
},
"home": {
"errors": 0,
"extra": null,
"hits": 3,
"innings": [
3,
0,
0,
null,
null,
null,
null,
null,
null
],
"total": 3
}
},
"status": {
"long": "Inning 4",
"short": "IN4"
},
"teams": {
"away": {
"id": 27,
"logo": "https://media.api-sports.io/baseball/teams/27.png",
"name": "Philadelphia Phillies"
},
"home": {
"id": 3,
"logo": "https://media.api-sports.io/baseball/teams/3.png",
"name": "Atlanta Braves"
}
},
"time": "00:00",
"timestamp": 1790899200,
"timezone": "UTC",
"week": "Final"
},
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2026,
"type": "League"
}
}
]
}Get standings
Get a season's tables, such as MLB's two leagues, six divisions and overall table: each team's place, games played, won and lost with its win percentage, runs scored and allowed, and form. Narrow to one team, stage or group.
Inputs
- League
league_idtextRequired - The competition, such as 1 for MLB, 2 for NPB or 5 for the KBO. Pick one from the list, or pass a league ID from an earlier step.
- Season
seasonnumberRequired - The season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Team ID
team_idtext - Optional. Only this team's line in each table it is in.
- Stage
stagetext - Optional. Only this stage, by name. List standings stages gives a season's stages.
- Group
grouptext - Optional. Only this table, by name, such as American League East. List standings groups gives a season's groups.
Outputs
countnumber- How many came back.
standingslist- The tables, in the API's order.
Example output
{
"count": 1,
"standings": [
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"group": "American League East",
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"stage": null,
"table": [
{
"description": null,
"form": "LWLLL",
"games": {
"losses": {
"percentage": 0.42,
"total": 68
},
"played": 162,
"wins": {
"percentage": 0.58,
"total": 94
}
},
"points": {
"against": 894,
"for": 1041
},
"position": 1,
"team": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
}
},
{
"description": null,
"form": "LLWWW",
"games": {
"losses": {
"percentage": 0.438,
"total": 71
},
"played": 162,
"wins": {
"percentage": 0.562,
"total": 91
}
},
"points": {
"against": 827,
"for": 970
},
"position": 2,
"team": {
"id": 4,
"logo": "https://media.api-sports.io/baseball/teams/4.png",
"name": "Baltimore Orioles"
}
},
{
"description": null,
"form": "WLLLW",
"games": {
"losses": {
"percentage": 0.5,
"total": 81
},
"played": 162,
"wins": {
"percentage": 0.5,
"total": 81
}
},
"points": {
"against": 877,
"for": 902
},
"position": 3,
"team": {
"id": 5,
"logo": "https://media.api-sports.io/baseball/teams/5.png",
"name": "Boston Red Sox"
}
},
{
"description": null,
"form": "LWWLL",
"games": {
"losses": {
"percentage": 0.506,
"total": 82
},
"played": 162,
"wins": {
"percentage": 0.494,
"total": 80
}
},
"points": {
"against": 818,
"for": 743
},
"position": 4,
"team": {
"id": 34,
"logo": "https://media.api-sports.io/baseball/teams/34.png",
"name": "Tampa Bay Rays"
}
},
{
"description": null,
"form": "LLLWL",
"games": {
"losses": {
"percentage": 0.543,
"total": 88
},
"played": 162,
"wins": {
"percentage": 0.457,
"total": 74
}
},
"points": {
"against": 918,
"for": 852
},
"position": 5,
"team": {
"id": 36,
"logo": "https://media.api-sports.io/baseball/teams/36.png",
"name": "Toronto Blue Jays"
}
}
]
}
]
}Get team statistics
Get a team's season in one competition: games played, won and lost at home, away and in all, with win percentages, and runs scored and allowed in total and per game.
Inputs
- League
league_idtextRequired - The competition, such as 1 for MLB, 2 for NPB or 5 for the KBO. Pick one from the list, or pass a league ID from an earlier step.
- Season
seasonnumberRequired - The season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Team ID
team_idtextRequired - The team's ID, such as 25 for the New York Yankees. Find teams looks one up. A team's ID is the same in every competition.
- Up to date
on_datedate - Optional. Count only games up to this day. The free plan takes only yesterday, today or tomorrow.
Outputs
countryobject- A country, or a region such as World for international competitions.
gamesobject- The team's record.
leagueobject- The competition, and the season this is from.
pointsobject- Runs scored and allowed (the API's points).
teamobject- A team.
Example output
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"games": {
"losses": {
"all": {
"percentage": 0.433,
"total": 90
},
"away": {
"percentage": 0.437,
"total": 45
},
"home": {
"percentage": 0.429,
"total": 45
}
},
"played": {
"all": 208,
"away": 103,
"home": 105
},
"wins": {
"all": {
"percentage": 0.558,
"total": 116
},
"away": {
"percentage": 0.563,
"total": 58
},
"home": {
"percentage": 0.552,
"total": 58
}
}
},
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"points": {
"against": {
"average": {
"all": 4.3,
"away": 4.1,
"home": 4.4
},
"total": {
"all": 894,
"away": 427,
"home": 467
}
},
"for": {
"average": {
"all": 5.0,
"away": 5.0,
"home": 5.0
},
"total": {
"all": 1041,
"away": 515,
"home": 526
}
}
},
"team": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
}
}List bet types
List the kinds of bet API-Baseball has odds for, such as Home/Away or Over/Under, with the IDs the odds filter takes.
Inputs
- Search
searchtext - Optional. Only names containing this, at least 3 characters.
Outputs
betslist- The bet types.
countnumber- How many came back.
Example output
{
"bets": [
{
"id": 1,
"name": "Home/Away"
},
{
"id": 2,
"name": "Asian Handicap"
}
],
"count": 2
}List bookmakers
List the bookmakers API-Baseball has odds from, with the IDs the odds filter takes. These IDs are API-Baseball's own: the same bookmaker can have another ID in another API-SPORTS API.
Inputs
- Search
searchtext - Optional. Only names containing this, at least 3 characters.
Outputs
bookmakerslist- The bookmakers.
countnumber- How many came back.
Example output
{
"bookmakers": [
{
"id": 1,
"name": "1xbet"
},
{
"id": 2,
"name": "Bet365"
}
],
"count": 2
}List countries
List the countries and regions that have baseball competitions in API-Baseball, each with its ID, code and flag. The names are what the Country filters take.
Inputs
- Search
searchtext - Optional. Only names containing this, at least 3 characters.
- Country code
codetext - Optional. Only the country with this two-letter code, such as US, JP or KR.
Outputs
countnumber- How many came back.
countrieslist- The countries.
Example output
{
"count": 1,
"countries": [
{
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
}
]
}List games
List games and results by day, by league and season, or by team, live ones included, each with its start time, status, and both sides' runs by inning, hits and errors. Scores update every 15 seconds during a game.
Inputs
- Date
on_datedate - Optional. Only games on this day, in the time zone chosen below. The free plan takes only yesterday, today or tomorrow.
- League
league_idtext - Optional. Only this competition. Pick one from the list, or pass a league ID such as 1 for MLB.
- Season
seasonnumber - Optional. Only this season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Team ID
team_idtext - Optional. Only this team, by ID, such as 25 for the New York Yankees.
- Time zone
timezonetext - Optional. Give dates and times in this time zone, such as America/New_York or Asia/Tokyo. UTC when left empty.
Outputs
countnumber- How many came back.
gameslist- The games, in the order given.
Example output
{
"count": 1,
"games": [
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"date": "2024-04-28T18:10:00+00:00",
"id": 153646,
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"scores": {
"away": {
"errors": 0,
"extra": null,
"hits": 18,
"innings": [
1,
0,
0,
0,
3,
7,
2,
2,
0
],
"total": 15
},
"home": {
"errors": 0,
"extra": null,
"hits": 11,
"innings": [
0,
0,
0,
0,
4,
1,
0,
0,
0
],
"total": 5
}
},
"status": {
"long": "Finished",
"short": "FT"
},
"teams": {
"away": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
},
"home": {
"id": 20,
"logo": "https://media.api-sports.io/baseball/teams/20.png",
"name": "Milwaukee Brewers"
}
},
"time": "18:10",
"timestamp": 1714327800,
"timezone": "UTC",
"week": null
}
]
}List head-to-head games
List the games two teams have played each other, in every season or only one league, season or day, with a count of each side's wins and runs across the finished ones.
Inputs
- First team ID
first_team_idtextRequired - One of the two teams, by ID, such as 25 for the New York Yankees. The summary counts its wins first.
- Second team ID
second_team_idtextRequired - The other team, by ID, such as 5 for the Boston Red Sox.
- League
league_idtext - Optional. Only this competition. Pick one from the list, or pass a league ID such as 1 for MLB.
- Season
seasonnumber - Optional. Only this season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
- Date
on_datedate - Optional. Only games on this day, in the time zone chosen below. The free plan takes only yesterday, today or tomorrow.
- Time zone
timezonetext - Optional. Give dates and times in this time zone, such as America/New_York or Asia/Tokyo. UTC when left empty.
Outputs
countnumber- How many came back.
gameslist- Their games, oldest first.
summaryobject- A count of the finished games among them.
Example output
{
"count": 2,
"games": [
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"date": "2024-03-13T17:05:00+00:00",
"id": 153031,
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"scores": {
"away": {
"errors": 0,
"extra": null,
"hits": 11,
"innings": [
0,
0,
0,
1,
1,
1,
5,
1,
0
],
"total": 9
},
"home": {
"errors": 1,
"extra": null,
"hits": 10,
"innings": [
1,
0,
0,
2,
1,
0,
0,
0,
0
],
"total": 4
}
},
"status": {
"long": "Finished",
"short": "FT"
},
"teams": {
"away": {
"id": 5,
"logo": "https://media.api-sports.io/baseball/teams/5.png",
"name": "Boston Red Sox"
},
"home": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
}
},
"time": "17:05",
"timestamp": 1710349500,
"timezone": "UTC",
"week": null
},
{
"country": {
"code": "US",
"flag": "https://media.api-sports.io/flags/us.svg",
"id": 1,
"name": "USA"
},
"date": "2024-03-17T17:05:00+00:00",
"id": 153104,
"league": {
"id": 1,
"logo": "https://media.api-sports.io/baseball/leagues/1.png",
"name": "MLB",
"season": 2024,
"type": "League"
},
"scores": {
"away": {
"errors": 2,
"extra": null,
"hits": 10,
"innings": [
0,
0,
0,
3,
0,
0,
0,
1,
2
],
"total": 6
},
"home": {
"errors": 0,
"extra": null,
"hits": 15,
"innings": [
9,
0,
0,
0,
0,
2,
1,
0,
null
],
"total": 12
}
},
"status": {
"long": "Finished",
"short": "FT"
},
"teams": {
"away": {
"id": 25,
"logo": "https://media.api-sports.io/baseball/teams/25.png",
"name": "New York Yankees"
},
"home": {
"id": 5,
"logo": "https://media.api-sports.io/baseball/teams/5.png",
"name": "Boston Red Sox"
}
},
"time": "17:05",
"timestamp": 1710695100,
"timezone": "UTC",
"week": null
}
],
"summary": {
"draws": 0,
"first_team_runs": 10,
"first_team_wins": 0,
"played": 2,
"second_team_runs": 21,
"second_team_wins": 2
}
}List seasons
List the seasons API-Baseball has data for, oldest first, as the four-digit years the Season fields take. A season played across two years is named by the year it starts in.
Inputs
None.
Outputs
countnumber- How many came back.
seasonslist- The seasons, oldest first.
Example output
{
"count": 20,
"seasons": [
2008,
2009,
2010,
2011,
2012,
2013,
2014,
2015,
2016,
2017,
2018,
2019,
2020,
2021,
2022,
2023,
2024,
2025,
2026,
2027
]
}List standings groups
List the tables a competition's season has, such as MLB's American League, its divisions and the overall MLB table, by the names Get standings takes as its Group.
Inputs
- League
league_idtextRequired - The competition, such as 1 for MLB, 2 for NPB or 5 for the KBO. Pick one from the list, or pass a league ID from an earlier step.
- Season
seasonnumberRequired - The season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
Outputs
countnumber- How many came back.
groupslist- The groups, by name.
Example output
{
"count": 9,
"groups": [
"American League",
"American League Central",
"American League East",
"American League West",
"MLB",
"National League",
"National League Central",
"National League East",
"National League West"
]
}List standings stages
List the named stages of a competition's season, such as a regular season and playoffs, which Get standings can narrow to. A season with a single unnamed stage, as MLB has, lists none.
Inputs
- League
league_idtextRequired - The competition, such as 1 for MLB, 2 for NPB or 5 for the KBO. Pick one from the list, or pass a league ID from an earlier step.
- Season
seasonnumberRequired - The season, as the four-digit year it starts in, such as 2024. The free plan reads the 2022 to 2024 seasons.From 1900 to 2100.
Outputs
countnumber- How many came back.
stageslist- The stages, by name.
Example output
{
"count": 0,
"stages": []
}