# Baseball Reference — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access comprehensive MLB and college baseball (NCAA Division I) statistics from Baseball-Reference. Retrieve player career and season stats, team rosters and performance data, game box scores, season schedules, league leaders, and college conference standings — all from a single API.

**Category:** Sports | **Website:** [baseball-reference.com/](https://baseball-reference.com/) | **Docs:** [parse.bot/marketplace/48aa8d38-4e1c-4351-964e-4a93f168efc1/baseball-reference-com-api](https://parse.bot/marketplace/48aa8d38-4e1c-4351-964e-4a93f168efc1/baseball-reference-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_box_score

Get detailed box score and play-by-play for a specific game. Returns batting and pitching lines for both teams plus play-by-play entries. Batting and pitching are keyed by team table ID (e.g., 'LosAngelesDodgersbatting'). Game IDs are discoverable from get_team_schedule boxscore_link fields.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `game_id` | string | Yes | Unique game ID consisting of 3-letter home team code, date (YYYYMMDD), and game number (e.g., 'LAN202403280', 'SDN202403200') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_box_score \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"game_id":"<string>"}'
```

### get_college_conference_teams

List all teams in a college conference or league for a specific year. League IDs are opaque hash strings. Team IDs in the response can be used with get_college_team_stats to retrieve detailed stats.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `league_id` | string | Yes | Register league/conference hash ID. Confirmed working: '82d1384a' (2025 SEC). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_college_conference_teams \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"league_id":"<string>"}'
```

### get_college_team_stats

Get college team statistics and rosters for Division 1 players via the Baseball-Reference Register. Returns roster, batting, and pitching tables. Team IDs can be discovered from get_college_conference_teams results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team_id` | string | Yes | Register team hash ID (e.g., '0294f3dc' for LSU). Discoverable from get_college_conference_teams results. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_college_team_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"<string>"}'
```

### get_league_leaders

Get statistical leaders for a specific year and category. Returns top players (typically 3) for each statistical category available on the leaderboard page. Categories include HR, batting average, WAR, stolen bases, and many more for batting; wins, ERA, strikeouts, etc. for pitching.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category` | string | No | Statistical category: 'batting' or 'pitching'. |
| `year` | integer | Yes | Season year (e.g., 2024) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_league_leaders \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"<string>","year":"<integer>"}'
```

### get_player_stats

Get comprehensive player statistics including batting, pitching, and fielding for careers and individual seasons. Returns season-by-season rows for each stat category the player has data for. The player page includes biographical info (position, bats/throws, birth date) and standard stat tables. Players with only batting or only pitching will have the other array empty.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `player_id` | string | Yes | Baseball-Reference player ID (e.g., 'ohtansh01', 'troutmi01', 'jeterde01') |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_player_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"player_id":"<string>"}'
```

### get_team_schedule

Get a team's schedule and game results for a specific year. Returns all regular season games with scores, opponents, win/loss record, and boxscore links. Game IDs can be extracted from boxscore_link for use with get_box_score.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team_id` | string | Yes | 3-letter MLB team abbreviation (e.g., 'LAD', 'NYY') |
| `year` | integer | Yes | Season year (e.g., 2024) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_team_schedule \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"<string>","year":"<integer>"}'
```

### get_team_stats

Get MLB team statistics, rosters, and staff for a specific year. Returns roster (appearances), team batting, and team pitching tables. Each table row includes per-player season stats.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team_id` | string | Yes | 3-letter MLB team abbreviation (e.g., 'LAD', 'NYY', 'HOU', 'BOS') |
| `year` | integer | Yes | Season year (e.g., 2024) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseball-reference-com-api-48aa8d38/get_team_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"<string>","year":"<integer>"}'
```
