NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server →

Baseball API

The Baseball API covers Major League Baseball: get the schedule from spring training to the World Series, live scores with the inning and half-inning on paid plans, final line scores with runs by inning, hits and errors, standings by division with games behind and playoff seeds, and every team's roster. league=mlb is the default, so no league parameter is needed. The free plan covers the current season's schedule, final scores, standings and rosters.

Available endpoints:

League guides: MLB API. One API key works for every sports API.

Baseball data at a glance

Line scoreRuns per inning in period_scores, with home_score and away_score as runs and hits and errors for both teams
Inningsperiod is the current or last inning played. During a game, status_detail says whether it is the top, middle, bottom or end of the inning
No game clockBaseball is untimed, so clock is always null
Extra inningsA tie after nine innings continues: decided_in is extra_innings and period_scores has a value for every inning
WeatherRain delays show as delayed, suspended games as suspended, and a postponed game keeps its game_id with the first date in original_date
DoubleheadersBoth games of a doubleheader have their own id; the second ends in -2
Standingsconference is AL or NL and division e.g. NL West, with games_behind, runs scored and allowed, last_10 and the playoff seed in conference_rank

League

LeagueWhat you getLeague value
MLBSchedules, live and final line scores by inning with hits and errors, standings by division, teams and rostersmlb
4 endpoints

https://api.api-ninjas.com/v1/baseballgames

Returns schedules, live scores and final scores. Ask for one day, a team's season or one game; with no parameters you get today's games. Paid plans see games in progress with the score, inning updated throughout the game; the free plan sees their status and the final score once they end. The free plan covers the current season. Developer plans add the three previous seasons, and the Business tier and above gets the full season archive.

Parameters

Every parameter is optional; league defaults to mlb.

  • league  optional

    Optional: mlb, the default.

  • date  optional

    Game day in the league's home time zone (YYYY-MM-DD). Defaults to today when no team or season is given.

  • team  optional

    Team id, abbreviation or name (e.g. NYY): that team's games in the season.

  • season  optional

    Season, as the year it starts (2026 = 2026-27 for seasons that span two years). Defaults to the current season. On its own, returns the season's games 50 per page; use offset for the next page.

  • season_type  optional

    Only games of this part of the season.

  • status  optional

    Only games with this status.

  • game_id  optional

    Return one game.

  • limit  optional Premium only

    Games per page (1-500). Default 50.

  • offset  optional

    Games to skip, for paging. Default 0.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The /v1/baseballgames endpoint returns a JSON array of games in start order, or an error.

  • game_id

    Unique id of the game, e.g. mlb-20260923-hou-sea. It never changes, even when a game is moved to another date.

  • league

    mlb.

  • sport

    Always baseball.

  • season

    Season, as the year it starts: 2026 is the 2026 season.

  • season_label

    Display form of the season, e.g. 2026.

  • season_type

    preseason (spring training), regular or postseason.

  • date

    Game day in US Eastern time (YYYY-MM-DD), so a West Coast night game keeps its US date.

  • start_time

    Scheduled start in UTC (ISO 8601).

  • status

    scheduled, in_progress, final, postponed, canceled, suspended (including abandoned soccer matches) or delayed (e.g. a rain delay).

  • status_detail Premium only

    During a game: top, middle, bottom or end of the inning. Otherwise null. While a game is in progress, the free plan sees This field is for premium subscribers only.

  • period Live values: Premium

    Current inning, or the last one played once the game is final. Extra innings continue the count (10, 11, ...). While a game is in progress, the free plan sees This field is for premium subscribers only.

  • clock

    Always null: baseball has no game clock. Use period and status_detail for the inning.

  • home_team, away_team

    The teams: team_id, name and abbreviation, named as they were that season.

  • home_score, away_score Live values: Premium

    Current or final score (runs); null before the game starts. While a game is in progress, the free plan sees This field is for premium subscribers only.

  • period_scores Live values: Premium

    Score per inning for home and away, with every extra inning. While a game is in progress, the free plan sees This field is for premium subscribers only.

  • hits, errors Live values: Premium

    Hits and errors for home and away, completing the line score.

  • decided_in

    For final games: regulation or extra_innings.

  • winner

    team_id of the winner once the game is final; null before that.

  • venue

    Where the game is played: name, city, state and country (ISO 3166-1 alpha-2).

  • neutral_site

    true when neither team is at home, e.g. international games, the Super Bowl and soccer cup finals.

  • original_date

    For a game moved to another date: the date it was first scheduled for. Otherwise null.

  • updated_at

    When any field of the game last changed (UTC).

Live Demo

Live demo · no API key required
Query parameters
league
date
team
season
season_type
status
game_id
limit
offset

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/baseballgames
Sample response
[
{
"game_id": "mlb-20260923-hou-sea",
"league": "mlb",
"sport": "baseball",
"season": 2026,
"season_label": "2026",
"season_type": "regular",
"date": "2026-09-23",
"start_time": "2026-09-24T02:00:00Z",
"status": "final",
"status_detail": null,
"period": 10,
"clock": null,
"home_team": {
"team_id": "mlb-sea",
"name": "Seattle Mariners",
"abbreviation": "SEA"
},
"away_team": {
"team_id": "mlb-hou",
"name": "Houston Astros",
"abbreviation": "HOU"
},
"home_score": 6,
"away_score": 5,
"period_scores": {
"home": [
0,
0,
3,
0,
1,
0,
0,
0,
0,
2
],
"away": [
0,
0,
4,
0,
0,
0,
0,
0,
0,
1
]
},
"hits": {
"home": 9,
"away": 10
},
"errors": {
"home": 0,
"away": 0
},
"decided_in": "extra_innings",
"winner": "mlb-sea",
"venue": {
"name": "T-Mobile Park",
"city": "Seattle",
"state": "WA",
"country": "US"
},
"neutral_site": false,
"original_date": null,
"updated_at": "2026-10-28T03:15:30Z"
}
]

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/baseballgames" \ -H "X-Api-Key: YOUR_API_KEY"

https://api.api-ninjas.com/v1/baseballstandings

Returns the league table for a season, ordered by league rank, or by conference or division rank when you filter. Tables update throughout the season, shortly after each game ends. The free plan covers the current season. Developer plans add the three previous seasons, and the Business tier and above gets the full season archive.

Parameters

  • league  optional

    Optional: mlb, the default.

  • season  optional

    Season, as the year it starts. Defaults to the current season.

  • conference  optional

    Only this conference, e.g. AL.

  • division  optional

    Only this division, e.g. NL West.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The /v1/baseballstandings endpoint returns a JSON array of team rows, or an error. Fields that do not apply to a league are left out.

  • league, sport, season, season_label

    League, sport and season of the table.

  • team

    team_id, name and abbreviation, named as they were that season.

  • conference, division

    The league as AL or NL, and the division, e.g. AL East.

  • games_played, wins, losses

    Record.

  • win_pct, games_behind

    Winning percentage and games behind the division leader.

  • points_for, points_against, point_differential

    Runs scored and allowed, and the run differential.

  • streak

    Current streak, e.g. W2 or L1.

  • home_record, away_record

    Home and road records, e.g. 4-1.

  • last_10

    Record over the last 10 games.

  • league_rank, conference_rank, division_rank

    Rank in the majors, in the AL or NL (conference_rank, the playoff seed) and in the division.

  • final

    true once the regular season is over and the table no longer changes.

Live Demo

Live demo · no API key required
Query parameters
league
season
conference
division

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/baseballstandings
Sample response
[
{
"league": "mlb",
"sport": "baseball",
"season": 2026,
"season_label": "2026",
"team": {
"team_id": "mlb-mil",
"name": "Milwaukee Brewers",
"abbreviation": "MIL"
},
"conference": "NL",
"division": "NL Central",
"games_played": 162,
"wins": 103,
"losses": 59,
"win_pct": 0.63580245,
"games_behind": 0,
"points_for": 832,
"points_against": 618,
"point_differential": 214,
"streak": "W5",
"home_record": "55-26",
"away_record": "48-33",
"last_10": "8-2",
"league_rank": 1,
"conference_rank": 1,
"division_rank": 1,
"final": false
}
]

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/baseballstandings" \ -H "X-Api-Key: YOUR_API_KEY"

https://api.api-ninjas.com/v1/baseballteams

Lists teams with their league, conference, division and home venue. Available on every plan.

Parameters

  • league  optional

    Optional: mlb.

  • team  optional

    Team id, abbreviation or name (e.g. NYY): return one team.

  • conference  optional

    Only teams in this conference.

  • division  optional

    Only teams in this division.

  • active  optional

    false lists former teams that appear in past seasons.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The /v1/baseballteams endpoint returns a JSON array of teams, or an error.

  • team_id

    Unique id, e.g. mlb-nyy. Use it, the abbreviation or the name in other endpoints.

  • league

    The team's league.

  • sport

    Always baseball.

  • abbreviation, name, city

    Identity of the team.

  • nickname, conference, division

    Nickname, current conference and division.

  • venue

    Home venue: name, city, state, country.

  • active

    true for current teams.

Live Demo

Live demo · no API key required
Query parameters
league
team
conference
division
active

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/baseballteams
Sample response
[
{
"team_id": "mlb-nyy",
"league": "mlb",
"sport": "baseball",
"abbreviation": "NYY",
"name": "New York Yankees",
"nickname": "Yankees",
"city": "New York",
"conference": "AL",
"division": "AL East",
"venue": {
"name": "Yankee Stadium",
"city": "Bronx",
"state": "New York",
"country": "US"
},
"active": true
}
]

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/baseballteams" \ -H "X-Api-Key: YOUR_API_KEY"

https://api.api-ninjas.com/v1/baseballplayers

Returns current rosters and player profiles, by team or by name. Rosters refresh every day. Available on every plan.

Parameters

Provide team or name, or a player_id.

  • league  optional

    Optional: mlb, the default.

  • team  optional

    Team id, abbreviation or name: that team's current roster.

  • name  optional

    Full or partial player name. Case and accents are ignored.

  • player_id  optional

    Return one player.

  • position  optional

    Only this position, e.g. SS.

  • limit  optional Premium only

    Players per page (1-500). Default 50.

  • offset  optional

    Players to skip, for paging. Default 0.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

The /v1/baseballplayers endpoint returns a JSON array of players, or an error. League-specific fields are left out where they do not apply.

  • player_id

    Unique id, e.g. mlb-p-7f7bb5fac7. It stays the same when a player changes teams.

  • league

    League of the player's current roster.

  • team

    Current team: team_id, name and abbreviation; null for a player whose roster_status is not_on_roster.

  • name, first_name, last_name

    Player name.

  • position, jersey_number

    Position abbreviation (e.g. SP, RP, C, SS, CF) and jersey number.

  • height_in, height_cm, weight_lb, weight_kg

    Height and weight.

  • birth_date, birth_place

    Date of birth and birthplace (city, state, country).

  • roster_status

    active, suspended or not_on_roster.

  • college, experience_years

    College and years of professional experience, where they apply.

Live Demo

Live demo · no API key required
Query parameters
league
team
name
player_id
position
limit
offset

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/baseballplayers?team=NYY
Sample response
[
{
"player_id": "mlb-p-7f7bb5fac7",
"league": "mlb",
"team": {
"team_id": "mlb-nyy",
"name": "New York Yankees",
"abbreviation": "NYY"
},
"name": "Anthony Volpe",
"first_name": "Anthony",
"last_name": "Volpe",
"position": "SS",
"jersey_number": "11",
"height_in": 70,
"height_cm": 178,
"weight_lb": 197,
"weight_kg": 89,
"birth_date": "2001-04-28",
"birth_place": {
"city": "New York",
"state": "NY",
"country": "US"
},
"roster_status": "active",
"experience_years": 4
}
]

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/baseballplayers?team=NYY" \ -H "X-Api-Key: YOUR_API_KEY"

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Baseball API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • Yes. The free plan covers the current MLB season: the full schedule, final scores with runs, hits and errors, standings, teams and rosters. Paid plans add live scores by inning and the three previous seasons.
  • Major League Baseball: spring training, the regular season and the postseason. league=mlb is the default, so no league parameter is needed. See the MLB API guide for the season, standings and roster details.
  • Use period_scores for the runs in each inning, home_score and away_score for the total runs, and hits and errors for the H and E columns. Extra innings add more entries to period_scores.
  • Baseball has no game clock. During a game, period is the inning and status_detail is top, middle, bottom or end, which together tell you exactly where the game is.
  • Call /v1/baseballstandings?division=AL East. Rows are ordered by division rank and include games_behind, win_pct, streak, last_10 and the playoff seed in the AL or NL in conference_rank.

API Ninjas is not affiliated with or endorsed by the NFL, the NBA, the NHL or any other league, competition or team. League, competition and team names are trademarks of their owners and are used only to identify them.