Developer

REST API

Access over 150 years of Major League Baseball statistics programmatically. All endpoints return JSON and require no authentication.

📖
Interactive API Explorer: Try endpoints directly in the Scalar API Reference (available in development mode), or view the raw OpenAPI specification.

Base URL

https://your-host/api

All endpoints below are relative to this base. Responses use application/json.

Pagination

List endpoints return a standard pagination envelope:

{
  "data": [ ... ],
  "page": 1,
  "pageSize": 25,
  "totalCount": 1234,
  "totalPages": 50
}

Use page and pageSize query parameters to navigate. Maximum pageSize is 100.

Players

GET/api/players

List players filtered by last name initial.

ParameterTypeDefaultDescription
letterstringALast name initial (A-Z)
pageint1Page number
pageSizeint25Results per page (max 100)

Example:

curl "https://your-host/api/players?letter=R&page=1&pageSize=10"
GET/api/players/{playerId}

Full player detail including career batting/pitching stats, teams played for, and Hall of Fame status.

Example:

curl "https://your-host/api/players/ruthba01"
GET/api/players/{playerId}/batting

Season-by-season batting statistics with team names and computed batting average.

GET/api/players/{playerId}/pitching

Season-by-season pitching statistics with ERA.

GET/api/players/{playerId}/fielding

Season-by-season fielding stats by position (putouts, assists, errors, double plays).

GET/api/players/{playerId}/awards

All awards won (MVP, Cy Young, Gold Glove, etc.).

GET/api/players/{playerId}/postseason/batting

Postseason batting stats by year and round (ALCS, NLCS, WS, etc.).

GET/api/players/{playerId}/postseason/pitching

Postseason pitching stats by year and round.

Teams

GET/api/teams/franchises

List all franchises with all-time records, championships, and pennants.

ParameterTypeDefaultDescription
leaguestringFilter by league (AL, NL)
activeOnlyboolfalseOnly active franchises

Example:

curl "https://your-host/api/teams/franchises?league=AL&activeOnly=true"
GET/api/teams/franchises/{franchiseId}

Franchise detail with every season's record, division/pennant/World Series wins.

Example:

curl "https://your-host/api/teams/franchises/NYY"
GET/api/teams/seasons/{teamId}/{lgId}/{year}

Complete team season: record, batting/pitching aggregates, full roster (batters and pitchers), and managers. Includes Hall of Fame flags.

Example:

curl "https://your-host/api/teams/seasons/NYA/AL/1927"

Leaders

GET/api/leaders/batting

Batting leaderboard ranked by any stat. Supports career and single-season modes.

ParameterTypeDefaultDescription
statstringhrStat to sort by: hr, h, avg, r, rbi, sb, bb, ops, obp, slg, 2b, 3b, g, ab
fromYearintStart year
toYearintEnd year
leaguestringLeague filter (AL, NL)
minAbint0Minimum at-bats
singleSeasonboolfalseSingle season vs. career totals
pageint1Page number
pageSizeint50Results per page (max 100)

Example: Top single-season home run totals since 2000:

curl "https://your-host/api/leaders/batting?stat=hr&singleSeason=true&fromYear=2000"
GET/api/leaders/pitching

Pitching leaderboard. ERA and WHIP sort ascending (lower is better); all others descending.

ParameterTypeDefaultDescription
statstringwStat to sort by: w, so, sv, era, whip, g, gs, cg, sho, ip, hr, k9, bb9, wpct
fromYearintStart year
toYearintEnd year
leaguestringLeague filter (AL, NL)
minIpint0Minimum innings pitched
singleSeasonboolfalseSingle season vs. career totals
pageint1Page number
pageSizeint50Results per page (max 100)

Example: Career strikeout leaders with at least 1000 IP:

curl "https://your-host/api/leaders/pitching?stat=so&minIp=1000"

Hall of Fame

GET/api/hall-of-fame

List Hall of Fame inductees with vote percentages.

ParameterTypeDefaultDescription
yearintInduction year
categorystringCategory: Player, Manager, Pioneer/Executive, Umpire
pageint1Page number
pageSizeint50Results per page (max 100)
GET/api/hall-of-fame/{playerId}/voting

Complete voting history for a player across all ballot years.

Example:

curl "https://your-host/api/hall-of-fame/jeterda01/voting"

Search

GET/api/search

Search across players and franchises by name. Returns both result types with total counts.

ParameterTypeDefaultDescription
qstringrequiredSearch query (min 2 characters)
limitint10Max results per type (max 50)

Example:

curl "https://your-host/api/search?q=griffey"

Salaries

GET/api/salaries/players/{playerId}

Player salary history with career total. Data available from 1985 onward.

Example:

curl "https://your-host/api/salaries/players/troutmi01"
GET/api/salaries/teams/{teamId}/{year}

Team payroll breakdown for a given season.

Example:

curl "https://your-host/api/salaries/teams/NYA/2014"
GET/api/salaries/leaders

Highest-paid players. Paginated.

ParameterTypeDefaultDescription
yearintFilter to a specific year
pageint1Page number
pageSizeint50Results per page (max 100)

Ballparks

GET/api/parks

List all ballparks. Paginated.

ParameterTypeDefaultDescription
statestringFilter by state code
pageint1Page number
pageSizeint50Results per page (max 100)
GET/api/parks/{parkKey}

Park detail with season-by-season attendance and game counts.

Postseason

GET/api/postseason/series

Postseason series results (World Series, LCS, Division Series, Wild Card). Paginated.

ParameterTypeDefaultDescription
yearintFilter by year
roundstringFilter by round (WS, ALCS, NLCS, ALDS, NLDS, ALWC, NLWC)
pageint1Page number
pageSizeint50Results per page (max 100)

Example: All World Series results:

curl "https://your-host/api/postseason/series?round=WS&pageSize=100"
GET/api/postseason/series/{year}

All postseason series for a given year.

Example:

curl "https://your-host/api/postseason/series/2024"

Awards

GET/api/awards/winners

Award winners with optional filters. Paginated.

ParameterTypeDefaultDescription
awardIdstringFilter by award (e.g. MVP, Cy Young, Gold Glove)
yearintFilter by year
lgIdstringFilter by league (AL, NL)
pageint1Page number
pageSizeint50Results per page (max 100)

Example: All AL MVP winners:

curl "https://your-host/api/awards/winners?awardId=MVP&lgId=AL"
GET/api/awards/voting/{awardId}/{year}/{lgId}

Full voting breakdown for an award race. Shows every candidate with points won, max possible, first-place votes, and vote share percentage.

Example: 2023 AL MVP voting race:

curl "https://your-host/api/awards/voting/MVP/2023/AL"

Response Codes

CodeMeaning
200Success
400Bad request (e.g. search query too short)
404Resource not found

Data Notes

  • All data is from the Lahman Baseball Database, covering 1871 to 2025.
  • The database is read-only. All endpoints are GET requests.
  • Player IDs follow the Lahman convention (e.g. ruthba01, jeterda01, troutmi01).
  • Franchise IDs match Lahman franchise codes (e.g. NYY, BOS, LAD).
  • Computed stats (AVG, OBP, SLG, OPS, ERA, WHIP) are calculated server-side and returned as rounded doubles.
  • Salary data is available from 1985 onward.
  • Innings pitched is stored as outs in the database and converted to innings (outs / 3) in responses.