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 or view the raw OpenAPI specification.

Base URL

https://baseballhistoryproject.com/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 by last name initial, with the same name, position, and era filters as the Players browser. Paginated.

ParameterTypeDefaultDescription
letterstringALast name initial (A-Z); ignored when q is set
qstring—Full-name search across all letters (case-insensitive)
posstring—Position ever played: P, C, 1B, 2B, 3B, SS, OF (includes LF/CF/RF), DH
eraint—Decade (e.g. 1920; any year in it works). Keeps players active during that decade
sortstringnamename, hr, hits, or games (career totals, descending)
pageint1Page number
pageSizeint25Results per page (max 100)

Examples:

curl "https://baseballhistoryproject.com/api/players?letter=R&page=1&pageSize=10"

Shortstops active in the 1920s, by career home runs:

curl "https://baseballhistoryproject.com/api/players?pos=SS&era=1920&sort=hr"
GET/api/players/{playerId}

Full player detail including career batting/pitching stats, teams played for, and Hall of Fame status. Also includes careerOpsIndex (career OPS vs. league, 100 = average), careerQualified, allStarSelections (distinct All-Star seasons), and hasManagerialCareer.

Example:

curl "https://baseballhistoryproject.com/api/players/ruthba01"
GET/api/players/{playerId}/batting

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

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

Season advanced batting, one row per season with stints combined: plate appearances, ISO, BABIP, BB%, K%, opsIndex (OPS vs. league, 100 = average, not park-adjusted), HR per 162 games, and season-relative qualification (3.1 PA per team game). A stat is null when its inputs weren’t recorded that season.

Example:

curl "https://baseballhistoryproject.com/api/players/ruthba01/batting/advanced"
GET/api/players/{playerId}/pitching

Season-by-season pitching statistics with ERA.

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

Season advanced pitching, one row per season with stints combined: games, starts, innings, ERA, WHIP, K/9, BB/9, and season-relative qualification (1 IP per team game).

Example:

curl "https://baseballhistoryproject.com/api/players/johnswa01/pitching/advanced"
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}/all-star

All-Star Game selections, newest first, with team, whether the player started (and at which position number), and whether the player appeared in the game.

GET/api/players/{playerId}/managing

Managerial stints (the player page’s Managing tab): team, in-season order, record, finish, and pennant/World Series flags. Returns an empty array for players who never managed.

Example:

curl "https://baseballhistoryproject.com/api/players/torrejo01/managing"
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, with the same name and era filters as the Teams browser.

ParameterTypeDefaultDescription
leaguestring—Filter by league (AL, NL)
activeOnlyboolfalseOnly active franchises
qstring—Franchise name contains (case-insensitive)
eraint—Decade (e.g. 1900). Keeps franchises that fielded a team during it

Examples:

curl "https://baseballhistoryproject.com/api/teams/franchises?league=AL&activeOnly=true"
curl "https://baseballhistoryproject.com/api/teams/franchises?q=giants&era=1930"
GET/api/teams/franchises/{franchiseId}

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

Example:

curl "https://baseballhistoryproject.com/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://baseballhistoryproject.com/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
fromYearint—Start year
toYearint—End year
leaguestring—League filter (AL, NL)
qualifiedbooltrueApply season-relative qualification for rate stats (AVG, OBP, SLG, OPS); ignored for counting stats
minAbint—Explicit minimum at-bats (overrides qualification)
singleSeasonboolfalseSingle season vs. career totals
pageint1Page number
pageSizeint50Results per page (max 100)

Qualification for rate stats: When qualified=true (default), the threshold is computed relative to each player's career games played: total plate appearances must equal or exceed 3.1 PA per team-game across all stints, with a minimum floor of 100 PA. This season-relative logic allows players from shorter-season eras (Negro Leagues, 19th century) to qualify naturally without needing arbitrary career totals. Set qualified=false to see all players including small-sample outliers, or provide an explicit minAb value to override automatic qualification.

Example: Career batting average leaders (qualified):

curl "https://baseballhistoryproject.com/api/leaders/batting?stat=avg&qualified=true"

Example: Career batting average, all players (no qualification):

curl "https://baseballhistoryproject.com/api/leaders/batting?stat=avg&qualified=false"
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
fromYearint—Start year
toYearint—End year
leaguestring—League filter (AL, NL)
qualifiedbooltrueApply season-relative qualification for rate stats (ERA, WHIP, K9, BB9, WPCT); ignored for counting stats
minIpint—Explicit minimum innings pitched (overrides qualification)
singleSeasonboolfalseSingle season vs. career totals
pageint1Page number
pageSizeint50Results per page (max 100)

Qualification for rate stats: When qualified=true (default), the threshold is computed relative to each player's career games played: total outs pitched must equal or exceed 3.0 outs per team-game across all stints (equivalent to 1 inning per game), with a minimum floor of 90 outs (30 innings). This season-relative logic allows pitchers from shorter-season eras to qualify naturally without needing arbitrary career inning totals. Set qualified=false to see all pitchers including small-sample outliers, or provide an explicit minIp value to override automatic qualification.

Example: Career ERA leaders (qualified):

curl "https://baseballhistoryproject.com/api/leaders/pitching?stat=era&qualified=true"

Example: Career strikeout leaders with explicit minimum of 1000 IP:

curl "https://baseballhistoryproject.com/api/leaders/pitching?stat=so&minIp=1000"

Hall of Fame

GET/api/hall-of-fame

List Hall of Fame inductees with vote percentages.

ParameterTypeDefaultDescription
yearint—Induction year
categorystring—Category: 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://baseballhistoryproject.com/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://baseballhistoryproject.com/api/search?q=griffey"

Salaries

GET/api/salaries/players/{playerId}

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

Example:

curl "https://baseballhistoryproject.com/api/salaries/players/troutmi01"
GET/api/salaries/teams/{teamId}/{year}

Team payroll breakdown for a given season.

Example:

curl "https://baseballhistoryproject.com/api/salaries/teams/NYA/2014"
GET/api/salaries/leaders

Highest-paid players. Paginated.

ParameterTypeDefaultDescription
yearint—Filter to a specific year
pageint1Page number
pageSizeint50Results per page (max 100)

Ballparks

GET/api/parks

List all ballparks. Paginated.

ParameterTypeDefaultDescription
statestring—Filter 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
yearint—Filter by year
roundstring—Filter by round (WS, ALCS, NLCS, ALDS, NLDS, ALWC, NLWC)
pageint1Page number
pageSizeint50Results per page (max 100)

Example: All World Series results:

curl "https://baseballhistoryproject.com/api/postseason/series?round=WS&pageSize=100"
GET/api/postseason/series/{year}

All postseason series for a given year.

Example:

curl "https://baseballhistoryproject.com/api/postseason/series/2024"

Awards

GET/api/awards/winners

Award winners with optional filters. Paginated.

ParameterTypeDefaultDescription
awardIdstring—Filter by award (e.g. MVP, Cy Young, Gold Glove)
yearint—Filter by year
lgIdstring—Filter by league (AL, NL)
pageint1Page number
pageSizeint50Results per page (max 100)

Example: All AL MVP winners:

curl "https://baseballhistoryproject.com/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://baseballhistoryproject.com/api/awards/voting/MVP/2023/AL"

Managers

GET/api/managers

Managers with career records and Hall of Fame flags. Paginated.

ParameterTypeDefaultDescription
qstring—First or last name contains (case-insensitive)
sortstringwinswins (career wins, descending) or name
pageint1Page number
pageSizeint50Results per page (max 100)

Example:

curl "https://baseballhistoryproject.com/api/managers?q=mack&sort=name"
GET/api/managers/{playerId}

A manager’s career: totals, pennants and World Series titles, every season stint, split-season halves (1892, 1981), and manager awards with whether voting data exists. Returns 404 for people who never managed.

Example:

curl "https://baseballhistoryproject.com/api/managers/mackco01"

All-Star Games

GET/api/all-star

Every All-Star season, newest first, with game count, distinct selections, and whether the Negro Leagues East-West Game was played that year (1933–1948).

Example:

curl "https://baseballhistoryproject.com/api/all-star"
GET/api/all-star/{year}

One season’s games (two AL–NL games in 1959–1962) with rosters by league or squad. gameType is AllStar, EastWest, or NorthSouth. Starters are listed first with their position; teamLgId is the club’s season league, which differs from the squad code in Negro Leagues games.

Example:

curl "https://baseballhistoryproject.com/api/all-star/1943"

Negro Leagues

GET/api/negro-leagues

The seven Negro Leagues (1920–1948) MLB recognizes as major leagues, with years, a summary, team-season and club counts.

Example:

curl "https://baseballhistoryproject.com/api/negro-leagues"
GET/api/negro-leagues/{lgId}

A league’s seasons (with champions) and its clubs’ aggregate records. lgId is NNL, ECL, ANL, EWL, NSL, NN2, or NAL (case-insensitive).

Example:

curl "https://baseballhistoryproject.com/api/negro-leagues/NN2"
GET/api/negro-leagues/{lgId}/{year}

Season standings with games behind, plus the top five in batting average and ERA (qualified) and home runs and wins. Leader values are numeric.

Example:

curl "https://baseballhistoryproject.com/api/negro-leagues/NN2/1943"

This Day in Baseball

GET/api/this-day

Birthdays, debuts, and final games on a calendar day — the data behind the home page widget. Hall of Famers rank first, then the most recent.

ParameterTypeDefaultDescription
datestringtodayMonth and day as MM-DD (e.g. 02-06; 02-29 allowed)
limitint5Entries per category (1–25)

Example:

curl "https://baseballhistoryproject.com/api/this-day?date=02-06&limit=10"

Response Codes

CodeMeaning
200Success
400Bad request (e.g. search query too short, or an unrecognized filter value such as pos=XX)
404Resource not found

Data Notes

  • All data is from the Lahman Baseball Database, covering 1871 to 2025.
  • Data obtained through the API carries the source licenses and attribution requirements — see Data Licensing & Attribution.
  • 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.