Product

Baseball API

Complete MLB and international baseball data (/api/baseball/...)

Live scores, fixtures, odds, standings, players, teams, and game events — delivered fast and reliably. Build apps, dashboards, betting tools, and analytics with developer‑friendly, scalable sports data.

Coverage

Global leagues and tournaments: MLB, Minor Leagues, NPB (Japan), KBO (Korea), international competitions, and more.

Live data

Real‑time game events: runs, hits, errors, innings, at-bats, pitching changes, lineups, and in‑play status with quick refresh.

Odds & markets

Pre‑game and in‑play odds across popular markets. Compare, track movements, and enrich betting tools and models.

Why choose our Baseball API

Our Baseball API is designed for performance, accuracy, and developer productivity. Whether you are building fan apps, score widgets, trading tools, or internal analytics, you get predictable response formats, consistent IDs, and robust coverage.

Key data sets

  • Games and schedules with status, venues, and team information
  • Live games grouped by league with real‑time scores
  • Teams with batting, pitching, and fielding statistics
  • Player profiles filtered by team or league
  • Standings grouped by division (AL East, NL West, etc.)
  • Pre‑match odds with bookmaker and market data
  • Team injury reports with player status updates

Typical use cases

Clients use the API for consumer apps, media portals, scoreboards, betting analytics, and BI pipelines. The API fits both real‑time UIs and batch data jobs, with pagination, filtering, and time‑window controls.

Integration in minutes

Authenticate with your API key, call the endpoint, and parse the JSON. You can start in minutes and scale to millions of requests with caching and retries.

Authentication

All API requests require authentication using an API key. You can send the API key in one of three ways:

  • HTTP Header (Recommended): X-Api-Key: your_api_key_here
  • Query Parameter: ?api_key=your_api_key_here
  • Request Body: { "api_key": "your_api_key_here" }

Available endpoints

The Baseball API provides comprehensive endpoints for all your data needs:

  • /baseball/countries — Get all countries with baseball leagues
  • /baseball/leagues — Get all active leagues with pagination
  • /baseball/countries/{countryId}/leagues — Get leagues by country
  • /baseball/leagues/{leagueId}/teams — Get teams in a league
  • /baseball/players — Get players (filter by team_id or league_id)
  • /baseball/games — Get games by date range (max 6 months, 500/page)
  • /baseball/live — Get all live games grouped by league
  • /baseball/teams/{team_id}/injuries — Get team injury reports
  • /baseball/teams/{team_id}/stats — Get team statistics (batting, pitching, fielding)
  • /baseball/odds — Get pre-match odds (max 5 days range)
  • /baseball/leagues/{league_id}/standings — League standings grouped by division

Example requests

Get all countries

GET https://api.api4sports.com/api/baseball/countries
Header: X-Api-Key: your_api_key_here

Get all leagues

GET https://api.api4sports.com/api/baseball/leagues?items_per_page=15&page=1
Header: X-Api-Key: your_api_key_here

Get leagues by country

GET https://api.api4sports.com/api/baseball/countries/{countryId}/leagues
Header: X-Api-Key: your_api_key_here

Get teams by league

GET https://api.api4sports.com/api/baseball/leagues/{leagueId}/teams
Header: X-Api-Key: your_api_key_here

Get players

GET https://api.api4sports.com/api/baseball/players?team_id=1&league_id=11590
Header: X-Api-Key: your_api_key_here

Get games by date range

GET https://api.api4sports.com/api/baseball/games?from=2024-05-01&to=2024-05-31&items_per_page=100&page=1
Header: X-Api-Key: your_api_key_here

Get live games

GET https://api.api4sports.com/api/baseball/live
Header: X-Api-Key: your_api_key_here

Get team injuries

GET https://api.api4sports.com/api/baseball/teams/{team_id}/injuries
Header: X-Api-Key: your_api_key_here

Get team statistics

GET https://api.api4sports.com/api/baseball/teams/{team_id}/stats
Header: X-Api-Key: your_api_key_here

Get pre-match odds

GET https://api.api4sports.com/api/baseball/odds?from=2024-05-15&to=2024-05-20&game_id=2602
Header: X-Api-Key: your_api_key_here

Get standings

GET https://api.api4sports.com/api/baseball/leagues/{league_id}/standings
Header: X-Api-Key: your_api_key_here

Error handling

The API uses standard HTTP status codes to indicate the success or failure of requests:

  • 200 OK — Request successful
  • 401 Unauthorized — API key is missing or invalid
  • 403 Forbidden — No active plan or no access to this sport/league
  • 404 Not Found — Resource not found
  • 422 Unprocessable Entity — Validation failed (check parameters)
  • 429 Too Many Requests — Daily request limit exceeded

Performance and reliability

Our infrastructure is tuned for low latency and high availability across regions. We apply intelligent caching, proactive monitoring, and data validation to ensure consistent quality. Rate limits scale with your plan; enterprise plans include dedicated throughput and priority support.

FAQ

Frequently asked questions

Answers about the Baseball API coverage, data freshness, and usage

Fixtures, live scores, game events, odds, standings, player stats, team info, lineups, head‑to‑head, and more.

Live game events are ingested in near real‑time with quick refresh; typical latency is seconds.

MLB, Minor Leagues, NPB (Japan), KBO (Korea), international tournaments, and more.

Yes. Commercial use is allowed per your selected plan. Enterprise agreements are available.

Still have questions?

Our support team is ready to help you get started. Reach out and we'll respond within hours.