Base URL

https://www.ballparkpal.com/api/v1

Use www to avoid redirect behavior.

OpenAPI Spec

/api/openapi.json

Machine-readable contract for integrations.

Response Formatting

Append ?pretty to any GET request for browser-friendly JSON.

Authentication

All /api/v1 endpoints require an API key except /api/v1/health.

Recommended: send the key in X-API-Key.

curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/games?date=2026-04-01"

Alternative: pass the key as query parameter apiKey.

curl -s "https://www.ballparkpal.com/api/v1/games?date=2026-04-01&apiKey=YOUR_API_KEY"

Response Format

Successful responses include a meta object and a data payload.

{
  "meta": { "asOf": "2026-02-09T18:21:07Z", "requestId": "..." },
  "data": ...
}

Errors are returned in a normalized error envelope.

{
  "error": {
    "code": "invalid_argument",
    "message": "Invalid integer parameter: teamId",
    "details": { "param": "teamId" },
    "requestId": "..."
  }
}

Status Codes

200 Successful request.
400 Invalid request parameters.
401 Missing or invalid API key.
404 Resource not found.
500 Internal server error.

Endpoints

GET /api/v1/health

Health check with database connectivity probe.

  • Response fields: status.
Auth: none
curl -s "https://www.ballparkpal.com/api/v1/health"
GET /api/v1/markets

Lists active market definitions.

  • Response fields: marketKey, marketType, subjectType, displayName, usesLine, status.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/markets"
GET /api/v1/teams

Lists teams.

  • Response fields: teamId, abv, city, nickname.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/teams"
GET /api/v1/players

Lists players with optional filters.

  • teamId (optional integer)
  • q (optional text; search on FullName)
  • Response fields: playerId, teamId, firstName, lastName, fullName.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/players?teamId=147&q=judge"
GET /api/v1/games

Lists games by date (preferred) or by gameId.

  • At least one of date=YYYY-MM-DD or gameId is required.
  • Response fields: gameId, gameDate, gameTime, teamAwayId, teamHomeId, venueId.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/games?date=2026-04-01"
GET /api/v1/games/{gameId}

Retrieves a single game by ID.

  • Response fields: gameId, gameDate, gameTime, teamAwayId, teamHomeId, venueId.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/games/776345"
GET /api/v1/projections

Returns projections for a single game.

  • gameId is required.
  • Response fields: marketType, marketKey, displayName, line, side, odds, probability, average, subject (object: type, id), teamId (when applicable).
  • average is the simulated average projection for the stat (e.g. projected hits, strikeouts). Null for probability-based markets like Moneyline and Pitcher Win.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/projections?gameId=776345"
GET /api/v1/parkfactors

Returns Ballpark Pal modeled park factors for every game on a given date.

  • date=YYYY-MM-DD is required.
  • Percent fields are integers (e.g. 18 = 18%). Amount fields are decimals representing estimated stat changes.
  • Response fields: gameId, gameTime, teamAway, teamHome, runsPercent, homeRunsPercent, doublesTriplesPercent, singlesPercent, runsAmount, homeRunsAmount, doublesTriplesAmount, singlesAmount.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/parkfactors?date=2026-04-01"
GET /api/v1/parkfactors/hitters

Returns individual hitter park factors at the game level.

  • At least one of date=YYYY-MM-DD or gameId is required.
  • Response fields: gameId, gameTime, teamAway, teamHome, playerId, playerName, team, homeRuns, doublesTriples, singles.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/parkfactors/hitters?date=2026-04-01"
GET /api/v1/matchups

Returns Ballpark Pal matchup model data for all batter-vs-starting-pitcher matchups on a given date. Probabilities are not park-adjusted; combine with /api/v1/parkfactors/hitters if park context is needed.

  • date=YYYY-MM-DD (required)
  • starters=true (optional; when set, only returns projected starting batters)
  • Probability fields are percentages with one decimal place (e.g. 4.2 = 4.2%).
  • VsTypical fields are integers representing percentage deviation from the batter's typical rate (e.g. 15 = 15% above typical, -8 = 8% below typical).
  • Fields may be null when no starting pitcher is announced or no model data exists for the matchup.
  • Response fields: gameId, batterId, batterName, batterTeam, pitcherId, pitcherName, pitcherTeam, homeRunProbability, doubleTripleProbability, singleProbability, walkProbability, strikeoutProbability, runsCreatedVsTypical, homeRunVsTypical, doubleTripleVsTypical, singleVsTypical, walkVsTypical, strikeoutVsTypical.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/matchups?date=2026-04-01"
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/matchups?date=2026-04-01&starters=true"
GET /api/v1/matchups/predict

Returns Ballpark Pal matchup model probabilities for any batter-pitcher pair. Probabilities are not park-adjusted.

  • batterId (required integer; MLB player ID)
  • pitcherId (required integer; MLB player ID)
  • Probability fields are percentages with one decimal place.
  • matchupAdvantage ranges from -10 (extreme pitcher advantage) to +10 (extreme batter advantage). 0 is neutral.
  • batterPercentile and pitcherPercentile are raw 0–100 values from the model.
  • Returns 404 if no model data exists for the given pair.
  • Response fields: batterId, batterName, batterTeam, pitcherId, pitcherName, pitcherTeam, reachProbability, hitProbability, homeRunProbability, doubleTripleProbability, singleProbability, walkProbability, strikeoutProbability, matchupAdvantage, batterPercentile, pitcherPercentile.
Auth: required
curl -s -H "X-API-Key: YOUR_API_KEY" "https://www.ballparkpal.com/api/v1/matchups/predict?batterId=592450&pitcherId=477132"

Example Response

GET /api/v1/games/776345

{
  "meta": {
    "asOf": "2026-02-10T03:54:58+00:00",
    "requestId": "65a7eadb-d29d-4ead-89c6-f013e0219f5b"
  },
  "data": {
    "gameId": 776345,
    "gameDate": "2025-09-12",
    "gameTime": "10:10",
    "teamAwayId": 108,
    "teamHomeId": 136,
    "venueId": 680
  }
}