# 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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/baseball-reference/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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/credits/baseball-reference/get-box-score \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-college-conference-teams \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-college-team-stats \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-league-leaders \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-player-stats \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-team-schedule \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/baseball-reference/get-team-stats \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"<string>","year":"<integer>"}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.