---
name: baseballapi
description: Look up baseball games, line scores, parks, players and league coverage with the Baseball Data API (baseballapi.net). Use when a question needs real game results or history from the US majors, the Negro Leagues, or leagues in Korea, Taiwan, Mexico, Venezuela, Cuba, Germany or Czechia.
---

# Baseball Data API

Game-by-game baseball data over a JSON API: finals and line scores, weather at the ground, umpires, parks with park factors, and people (players, managers, coaches, umpires). Operated by DeveloperData.net. Times are UTC; a game's date is its day at the ground.

## When to use it, and when not

Use it for results, line scores and history: "who won", "what was the score by inning", "which ground", "how many runs a game does this park give up", "when did this player debut". It does not hold pitch-tracking measurements (exit velocity, spin rate), betting odds or injuries. The minor leagues are held as team seasons, not game by game.

## Getting access

Every account has one key. Send it in a header on every call, never in the address:

```
X-API-Key: YOUR_KEY
Authorization: Bearer YOUR_KEY
```

The free key reads games from yesterday on, 50 calls a day and 10 a minute. Older seasons are on the paid plans.

## The calls that answer most questions

Base address: `https://api.baseballapi.net`.

Which leagues are held, and how fully:

```
curl https://api.baseballapi.net/v1/leagues -H "X-API-Key: YOUR_KEY"
```
```json
{"data": [{"league": "mlb", "name": "MLB", "country": "United States", "first_season": 1897, "last_season": 2026, "games": 220475, "with_play_by_play": 206492}], "meta": {"count": 11}}
```

Games on a day (or `from` and `to`, up to 366 days), with finals:

```
curl "https://api.baseballapi.net/v1/mlb/games?date=yesterday" -H "X-API-Key: YOUR_KEY"
```
```json
{"data": [{"id": "gm_9tw9rna6", "league": "mlb", "date": "2026-10-29", "status": "final", "away": {"name": "...", "runs": 3}, "home": {"name": "...", "runs": 5}, "venue": "..."}], "meta": {"count": 1, "total": 1, "next_cursor": null}}
```

One game with its line score, weather and umpires: `GET /v1/{league}/games/{id}`.
Every league's finals from yesterday in one call: `GET /v1/results/yesterday`.
Parks: `GET /v1/parks` (`?season=` for one season) and `GET /v1/parks/{id}` (games, runs per game and park factor by season).
People: `GET /v1/players?name=babe%20ruth` and `GET /v1/players/{id}`.
Your own plan and calls today: `GET /v1/usage` (not counted).

League slugs: mlb, negro, kbo, cpbl, lmp, lvbp, cuba, germany, czech, intl.

## Limits

Rate limit headers on every answer: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `X-Quota-Remaining`. Lists take `page` and `per_page` (at most 200); game lists also give `next_cursor`.

## Errors

`{"error": {"code": "...", "message": "...", "docs": "..."}}`. Codes: `bad_request` 400, `unauthorized` 401, `upgrade_required` 403 (names the plan that has it), `not_found` 404, `unknown_parameter` 422 (lists the allowed ones), `rate_limited` 429 (slow down; see `Retry-After`), `quota_exceeded` 429 (the day's calls are used; resets 00:00 UTC), `server_error` 500.

## A typical workflow

1. Call `/v1/leagues` once to learn the slugs and what each league holds.
2. Find games with `/v1/{league}/games?date=...` or a `from`/`to` range; read on with `next_cursor`.
3. Open a game with `/v1/{league}/games/{id}` for its line score, weather and umpires.
4. On `rate_limited`, wait for `Retry-After`; on `upgrade_required`, tell the user which plan has it.

The whole API in one file: https://baseballapi.net/documentation/manual.md
