# Baseballsavant Mlb — 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 MLB batting leaderboard data focused on power metrics like barrel rate, exit velocity, and expected stats to analyze player performance. Compare hitters across the league or dive into individual player power statistics to find advanced hitting insights from Baseball Savant's Statcast database.

**Category:** Sports | **Website:** [baseballsavant.mlb.com/leaderboard/custom?year=2026&type=batter&filter=&min=q&selections=pa%2Ck_percent%2Cbb_percent%2Cwoba%2Cxwoba%2Csweet_spot_percent%2Cbarrel_batted_rate%2Chard_hit_percent%2Cavg_best_speed%2Cavg_hyper_speed%2Cwhiff_percent%2Cswing_percent&chart=false&x=pa&y=pa&r=no&chartType=beeswarm&sort=xwoba&sortDir=desc](https://baseballsavant.mlb.com/leaderboard/custom?year=2026&type=batter&filter=&min=q&selections=pa%2Ck_percent%2Cbb_percent%2Cwoba%2Cxwoba%2Csweet_spot_percent%2Cbarrel_batted_rate%2Chard_hit_percent%2Cavg_best_speed%2Cavg_hyper_speed%2Cwhiff_percent%2Cswing_percent&chart=false&x=pa&y=pa&r=no&chartType=beeswarm&sort=xwoba&sortDir=desc) | **Docs:** [parse.bot/marketplace/50643271-6bc7-4b1c-b277-6f25b5e724d5/baseballsavant-mlb-com-api](https://parse.bot/marketplace/50643271-6bc7-4b1c-b277-6f25b5e724d5/baseballsavant-mlb-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-baseballsavant-mlb-com-api-50643271/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_batting_leaderboard

Retrieve the Statcast custom batting leaderboard with power and home run metrics. Returns qualified batters sorted by the specified stat field. Includes advanced Statcast metrics like barrel rate, exit velocity, hard-hit percentage, swing speed, and expected stats (xwOBA, xSLG). Data is sourced from the current MLB season's Statcast tracking system. One page of results; use limit to control count.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Maximum number of players to return. |
| `min_pa` | string | No | Minimum plate appearances filter. 'q' means qualified (league-defined threshold). |
| `sort` | string | No | Stat field to sort the leaderboard by. |
| `sort_dir` | string | No | Sort direction. |
| `year` | string | No | MLB season year (4-digit, e.g. 2025, 2024, 2023). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseballsavant-mlb-com-api-50643271/get_batting_leaderboard \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","min_pa":"<string>","sort":"<string>","sort_dir":"<string>","year":"<string>"}'
```

### get_player_power_stats

Retrieve detailed Statcast power and home run metrics for a specific player by their MLB player ID. Returns comprehensive batting data including exit velocity, barrel rate, hard-hit percentage, swing speed, and expected stats. The player must have at least 10 plate appearances in the specified season to appear in the data.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `player_id` | string | Yes | Numeric MLB player ID (e.g. 660271 for Shohei Ohtani, 592450 for Aaron Judge). Obtainable from get_batting_leaderboard results. |
| `year` | string | No | MLB season year (4-digit, e.g. 2025, 2024, 2023). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-baseballsavant-mlb-com-api-50643271/get_player_power_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"player_id":"<string>","year":"<string>"}'
```
