# Nippon Professional Baseball — 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 data from npb.jp.

**Category:** Sports | **Website:** [npb.jp/eng/](https://npb.jp/eng/) | **Docs:** [parse.bot/marketplace/d417ed2d-4e73-4b6a-9cc6-a83f3e0efabf/npb-jp-api](https://parse.bot/marketplace/d417ed2d-4e73-4b6a-9cc6-a83f3e0efabf/npb-jp-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-npb-jp-api-d417ed2d/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_all_active_players

Retrieve a list of all active NPB players from the English-language roster pages. Returns player names (English only — entries containing Japanese characters are filtered out), team names, and player IDs. Optionally narrow results to a single team. Each player record includes the player_id usable with get_player_career_stats.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team` | string | No | NPB team identifier. When omitted, returns players from all 12 teams. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_all_active_players \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team":"<string>"}'
```

### get_both_standings

Retrieve current league standings for both the Central League and Pacific League in a single response. Each league section includes wins, losses, ties, winning percentage, games behind, and head-to-head records. Teams are ordered by position within each league.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `season` | string | No | Season year in YYYY format. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_both_standings \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"season":"<string>"}'
```

### get_player_career_stats

Retrieve year-by-year career statistics for an individual NPB player. Returns biographical information and complete season-by-season batting or pitching stats depending on position. The player_id is obtained from the team roster endpoint.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `player_id` | string | Yes | NPB player identifier (8-digit numeric string). Obtain from get_team_roster results. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_player_career_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"player_id":"<string>"}'
```

### get_team_batting_stats

Retrieve current-season batting statistics for all players on a specified NPB team. Each player entry includes games played, at-bats, hits, home runs, RBI, batting average, slugging, OBP, and other standard batting metrics. Stats reflect the most recent game day. When auto_update is true, the endpoint dynamically crawls calendar game pages from April through the current month, follows each game link, extracts per-player batting stats from /bis/eng/ pages, and aggregates cumulative season totals.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `auto_update` | boolean | No | When true, dynamically crawls all available calendar months for the season (April through current month), follows each game link, extracts per-player batting stats from English /bis/eng/ game pages, and aggregates cumulative season totals. New game days are automatically included as they appear on the calendar. |
| `season` | string | No | Season year in YYYY format. |
| `team` | string | Yes | NPB team identifier. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_team_batting_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_update":"<boolean>","season":"<string>","team":"<string>"}'
```

### get_team_pitching_stats

Retrieve current-season pitching statistics for all pitchers on a specified NPB team. Each pitcher entry includes wins, losses, saves, holds, ERA, innings pitched, strikeouts, and other standard pitching metrics. Stats reflect the most recent game day. When auto_update is true, the endpoint dynamically crawls calendar game pages from April through the current month, follows each game link, extracts per-player pitching stats from /bis/eng/ pages, and aggregates cumulative season totals.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `auto_update` | boolean | No | When true, dynamically crawls all available calendar months for the season (April through current month), follows each game link, extracts per-player pitching stats from English /bis/eng/ game pages, and aggregates cumulative season totals. New game days are automatically included as they appear on the calendar. |
| `season` | string | No | Season year in YYYY format. |
| `team` | string | Yes | NPB team identifier. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_team_pitching_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_update":"<boolean>","season":"<string>","team":"<string>"}'
```

### get_team_roster

Retrieve the current active roster for a specified NPB team. Returns all registered players with their jersey number, position group, birth date, physical measurements, and the player_id needed to look up career statistics.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `team` | string | Yes | NPB team identifier. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_team_roster \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"team":"<string>"}'
```

### get_team_standings

Retrieve current league standings for the Central or Pacific League. Includes wins, losses, ties, winning percentage, games behind, and head-to-head records against each opponent. Updated daily during the season.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `league` | string | No | NPB league. |
| `season` | string | No | Season year in YYYY format. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-npb-jp-api-d417ed2d/get_team_standings \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"league":"<string>","season":"<string>"}'
```
