# MLB stat leaderboard with sorting and filters API

Fetch sortable MLB stat leaderboards via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as group, limit, output, and retrieve structured data including current pagination offset, next offset, MLB player identifier, player full name, and player position code to build sortable fantasy tables, explore sabermetrics and expected stats, and paginate full league leaderboards.

Documentation: https://openany.si/mlb-stats/mlb-stats-mlb-stat-leaderboard-with-sorting-and-filters-api/364a25f3-501f-4d61-a19f-da2a5778342d/
API ID: 364a25f3-501f-4d61-a19f-da2a5778342d
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/mlb/v1/stats
Page update time: 2026-12-03T02:44:10.149Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:44:08.996Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Usage and limits
## MLB Stat Leaderboard API

Query sortable player tables with optional group (hitting default, pitching, fielding, catching, running), season, type (season, seasonAdvanced, sabermetrics, expectedStatistics, career, careerAdvanced), sort, order (asc/desc), pool (qualified, all, rookies, qualified\_rookies), team\_id, league, position, offset, limit (default 50, max 100) and sport\_id.

## What You Can Build

- **Build sortable fantasy tables**: Sort qualified hitters by ops or homeRuns, or pitchers by era, whip or strikeOuts with position filters.
- **Explore sabermetrics and expected stats**: Set type to sabermetrics or expectedStatistics to surface advanced metrics beyond basic counting stats.
- **Paginate full league leaderboards**: Loop over next\_offset with limit=100 until next\_offset is null to export an entire season table.

## Returned Data

| Field | Meaning |
| --- | --- |
| `count` | Number of player rows in this page |
| `total` | Total matching players across all pages |
| `offset` | Current pagination offset |
| `next_offset` | Offset for the next page, or null on the last page |
| `players[].rank` | Player rank under the selected sort |
| `players[].player.id` | MLB player identifier |
| `players[].player.name` | Player full name |
| `players[].position` | Player position code |
| `players[].league` | Player league abbreviation |
| `players[].stat` | Full statistical line object for the player |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "MLB stat leaderboard with sorting and filters API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "group": {
          "type": "string",
          "description": "hitting (default), pitching, fielding, catching, running."
        },
        "season": {
          "type": "string",
          "description": "Season year; default this year."
        },
        "type": {
          "type": "string",
          "description": "season (default), seasonAdvanced, sabermetrics, expectedStatistics, career, careerAdvanced.",
          "enum": [
            "season",
            "seasonAdvanced",
            "sabermetrics",
            "expectedStatistics",
            "career",
            "careerAdvanced"
          ]
        },
        "sort": {
          "type": "string",
          "description": "Stat to sort by, e.g. homeRuns, avg, ops, era, strikeOuts, whip (default ops for hitting, era for pitching)."
        },
        "order": {
          "type": "string",
          "description": "asc or desc.",
          "enum": [
            "asc",
            "desc"
          ]
        },
        "pool": {
          "type": "string",
          "description": "qualified (default), all, rookies, qualified_rookies.",
          "enum": [
            "qualified",
            "all",
            "rookies",
            "qualified_rookies"
          ]
        },
        "team_id": {
          "type": "string",
          "description": "Team id or abbreviation."
        },
        "league": {
          "type": "string",
          "description": "al or nl.",
          "enum": [
            "al",
            "nl"
          ]
        },
        "position": {
          "type": "string",
          "description": "C, 1B, 2B, 3B, SS, LF, CF, RF, OF, DH, P, SP, RP."
        },
        "offset": {
          "type": "integer",
          "description": "Rows to skip (from next_offset)."
        },
        "limit": {
          "type": "integer",
          "description": "Rows per page (default 50, max 100)."
        },
        "sport_id": {
          "type": "string",
          "description": "Level: 1 MLB (default), 11 Triple-A, 12 Double-A, 13 High-A, 14 Single-A, 16 Rookie, 17 winter leagues, 51 international.",
          "enum": [
            "1",
            "11",
            "12",
            "13",
            "14",
            "16",
            "17",
            "21",
            "22",
            "23",
            "51",
            "586"
          ]
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      }
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "applied_filters": {
      "type": "object",
      "properties": {
        "group": {
          "type": "string"
        },
        "league": {
          "type": "null"
        },
        "order": {
          "type": "null"
        },
        "pool": {
          "type": "string"
        },
        "position": {
          "type": "null"
        },
        "season": {
          "type": "integer"
        },
        "sort": {
          "type": "string"
        },
        "sport_id": {
          "type": "integer"
        },
        "team_id": {
          "type": "null"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "next_offset": {
      "type": "integer"
    },
    "offset": {
      "type": "integer"
    },
    "players": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "league": {
            "type": "string"
          },
          "player": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "position": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "stat": {
            "type": "object",
            "properties": {
              "age": {
                "type": "integer"
              },
              "airOuts": {
                "type": "integer"
              },
              "atBats": {
                "type": "integer"
              },
              "avg": {
                "type": "string"
              },
              "balks": {
                "type": "integer"
              },
              "baseOnBalls": {
                "type": "integer"
              },
              "battersFaced": {
                "type": "integer"
              },
              "blownSaves": {
                "type": "integer"
              },
              "catchersInterference": {
                "type": "integer"
              },
              "caughtStealing": {
                "type": "integer"
              },
              "caughtStealingPercentage": {
                "type": "string"
              },
              "completeGames": {
                "type": "integer"
              },
              "doubles": {
                "type": "integer"
              },
              "earnedRuns": {
                "type": "integer"
              },
              "era": {
                "type": "string"
              },
              "gamesFinished": {
                "type": "integer"
              },
              "gamesPitched": {
                "type": "integer"
              },
              "gamesPlayed": {
                "type": "integer"
              },
              "gamesStarted": {
                "type": "integer"
              },
              "groundIntoDoublePlay": {
                "type": "integer"
              },
              "groundOuts": {
                "type": "integer"
              },
              "groundOutsToAirouts": {
                "type": "string"
              },
              "hitBatsmen": {
                "type": "integer"
              },
              "hitByPitch": {
                "type": "integer"
              },
              "hits": {
                "type": "integer"
              },
              "hitsPer9Inn": {
                "type": "string"
              },
              "holds": {
                "type": "integer"
              },
              "homeRuns": {
                "type": "integer"
              },
              "homeRunsPer9": {
                "type": "string"
              },
              "inheritedRunners": {
                "type": "integer"
              },
              "inheritedRunnersScored": {
                "type": "integer"
              },
              "inningsPitched": {
                "type": "string"
              },
              "intentionalWalks": {
                "type": "integer"
              },
              "losses": {
                "type": "integer"
              },
              "numberOfPitches": {
                "type": "integer"
              },
              "obp": {
                "type": "string"
              },
              "ops": {
                "type": "string"
              },
              "outs": {
                "type": "integer"
              },
              "pickoffs": {
                "type": "integer"
              },
              "pitchesPerInning": {
                "type": "string"
              },
              "runs": {
                "type": "integer"
              },
              "runsScoredPer9": {
                "type": "string"
              },
              "sacBunts": {
                "type": "integer"
              },
              "sacFlies": {
                "type": "integer"
              },
              "saveOpportunities": {
                "type": "integer"
              },
              "saves": {
                "type": "integer"
              },
              "shutouts": {
                "type": "integer"
              },
              "slg": {
                "type": "string"
              },
              "stolenBasePercentage": {
                "type": "string"
              },
              "stolenBases": {
                "type": "integer"
              },
              "strikeOuts": {
                "type": "integer"
              },
              "strikePercentage": {
                "type": "string"
              },
              "strikeoutWalkRatio": {
                "type": "string"
              },
              "strikeoutsPer9Inn": {
                "type": "string"
              },
              "strikes": {
                "type": "integer"
              },
              "totalBases": {
                "type": "integer"
              },
              "triples": {
                "type": "integer"
              },
              "walksPer9Inn": {
                "type": "string"
              },
              "whip": {
                "type": "string"
              },
              "wildPitches": {
                "type": "integer"
              },
              "winPercentage": {
                "type": "string"
              },
              "wins": {
                "type": "integer"
              }
            }
          },
          "team": {
            "type": "object",
            "properties": {
              "abbreviation": {
                "type": "string"
              },
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "total": {
      "type": "integer"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/mlb/v1/stats?group=pitching&limit=1&output=json&raw=0&season=2026' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "applied_filters": {
    "group": "pitching",
    "league": null,
    "order": null,
    "pool": "qualified",
    "position": null,
    "season": 2026,
    "sort": "earnedRunAverage",
    "sport_id": 1,
    "team_id": null,
    "type": "season"
  },
  "cached": false,
  "count": 1,
  "credits_used": 1,
  "fetched_at": "2026-11-19T12:22:09.494Z",
  "next_offset": 1,
  "offset": 0,
  "players": [
    {
      "league": "NL",
      "player": {
        "id": 694819,
        "name": "Jacob Misiorowski"
      },
      "position": "P",
      "rank": 1,
      "stat": {
        "age": 24,
        "airOuts": 138,
        "atBats": 610,
        "avg": ".157",
        "balks": 1,
        "baseOnBalls": 44,
        "battersFaced": 665,
        "blownSaves": 0,
        "catchersInterference": 0,
        "caughtStealing": 1,
        "caughtStealingPercentage": ".333",
        "completeGames": 1,
        "doubles": 8,
        "earnedRuns": 35,
        "era": "1.80",
        "gamesFinished": 0,
        "gamesPitched": 30,
        "gamesPlayed": 30,
        "gamesStarted": 30,
        "groundIntoDoublePlay": 11,
        "groundOuts": 126,
        "groundOutsToAirouts": "0.91",
        "hitBatsmen": 9,
        "hitByPitch": 9,
        "hits": 96,
        "hitsPer9Inn": "4.95",
        "holds": 0,
        "homeRuns": 14,
        "homeRunsPer9": "0.72",
        "inheritedRunners": 0,
        "inheritedRunnersScored": 0,
        "inningsPitched": "174.2",
        "intentionalWalks": 0,
        "losses": 5,
        "numberOfPitches": 2647,
        "obp": ".224",
        "ops": ".470",
        "outs": 524,
        "pickoffs": 0,
        "pitchesPerInning": "15.15",
        "runs": 43,
        "runsScoredPer9": "2.22",
        "sacBunts": 1,
        "sacFlies": 1,
        "saveOpportunities": 0,
        "saves": 0,
        "shutouts": 1,
        "slg": ".246",
        "stolenBasePercentage": ".667",
        "stolenBases": 2,
        "strikeOuts": 252,
        "strikePercentage": ".680",
        "strikeoutWalkRatio": "5.73",
        "strikeoutsPer9Inn": "12.98",
        "strikes": 1789,
        "totalBases": 150,
        "triples": 2,
        "walksPer9Inn": "2.27",
        "whip": "0.80",
        "wildPitches": 6,
        "winPercentage": ".762",
        "wins": 16
      },
      "team": {
        "abbreviation": "MIL",
        "id": 158,
        "name": "Milwaukee Brewers"
      }
    }
  ],
  "total": 46
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### How do I paginate through more than 100 players?
Use limit (default 50, max 100) and pass the returned next_offset value into offset until next_offset is null.

### Are sabermetrics and expected statistics supported?
Yes. The type parameter accepts season, seasonAdvanced, sabermetrics, expectedStatistics, career and careerAdvanced.

### How do I filter for rookies or unqualified players?
Set pool to qualified (default), all, rookies or qualified_rookies.

### Can I filter the leaderboard by fielding position or club?
Yes. Pass position (e.g. C, 1B, SS, OF, SP, RP) and team_id (numeric ID or abbreviation).

### What default sort is used if I omit sort?
It defaults to ops for hitting and era for pitching; pass order=asc or order=desc to control direction.

### How do caching and payload trimming work?
Pass fresh=1 to skip the 24-hour cache, raw=0 to omit bulky raw blocks and fields to select specific keys.

## Available implementations
- apish: https://openany.si/mlb-stats/mlb-stats-mlb-stat-leaderboard-with-sorting-and-filters-api/364a25f3-501f-4d61-a19f-da2a5778342d/

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
