# MLB Scraper (`solidcode/mlb-scraper`) Actor

\[💰 $20 / 1K] Extract MLB games, teams, rosters, players, and standings — scores, schedules, matchups, player bios and season stats, and division and wild-card standings. Pick clubs by name or abbreviation, filter by season and game type.

- **URL**: https://apify.com/solidcode/mlb-scraper.md
- **Developed by:** [SolidCode](https://apify.com/solidcode) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## MLB Scraper

Pull Major League Baseball data at scale — game schedules and scores, all 30 clubs, active rosters, player bios with season hitting and pitching stats, and division, league, and wild-card standings. One structured input picks between five data types, and you name teams and players in plain English — no numeric IDs to look up. Built for sports analysts, fantasy-baseball tools, betting modelers, and journalists who need clean, structured MLB data without wrangling the official stats API by hand.

### Why This Scraper?

- **Five data types in one actor** — games, teams, rosters, players, and standings, switched with a single dropdown. Most MLB scrapers skip standings entirely.
- **All 30 MLB clubs across the AL and NL** — full name, abbreviation, league, division, home venue, and first year of play for every franchise.
- **Season hitting and pitching stats** — HR, AVG, OBP, SLG, OPS, RBI, ERA, and the full stat block per player, grouped into hitting, pitching, and fielding.
- **Six game types including the World Series and Spring Training** — filter to Regular Season, Wild Card, Division Series, League Championship, World Series, or Spring Training.
- **Four standings views including the wild-card race** — by division, by league, wild card, or wild card with division leaders, each with games back and wild-card games back.
- **Name teams and players in plain English** — "New York Yankees", "NYY", "Shohei Ohtani", or a mlb.com URL all resolve automatically; no need to know that 147 is the Yankees or 660271 is Ohtani.
- **Box-score-grade game data** — final scores, linescore runs/hits/errors, winning/losing/save pitchers, venue, series description, and day/night flag on every game row.
- **Any season the official record covers** — pick any year from 1876 to the current season for games, rosters, players, and standings.

### Use Cases

**Sports Analytics**
- Track team win percentage, run differential, and streaks across a season
- Compare hitting and pitching production between players and clubs
- Build historical performance datasets across multiple seasons
- Monitor division and wild-card races as standings shift

**Fantasy Baseball**
- Pull season stat lines for every player on a roster to power draft rankings
- Refresh active rosters to catch call-ups, trades, and IL moves
- Score players on HR, RBI, OBP, SLG, ERA, and other category leaders
- Map jersey numbers, positions, and status for lineup tools

**Betting Models**
- Feed final scores and run totals into predictive models
- Analyze head-to-head matchups by team, venue, and game type
- Isolate postseason performance with World Series and Division Series filters
- Track streaks and games back to gauge momentum

**Journalism & Media**
- Auto-build box-score summaries and standings tables for coverage
- Pull player bios — birthplace, debut date, height, weight, bats/throws
- Generate wild-card race snapshots on demand
- Verify schedules and results against the official record

**Research & Data Products**
- Assemble multi-season baseball datasets for study
- Power dashboards with structured team, player, and standings feeds
- Enrich existing rosters with current-season stat lines
- Archive full-season schedules with scores and outcomes

### Getting Started

#### Today's Games

The simplest run — leave the dates blank to get today's schedule with scores:

```json
{
    "dataType": "games"
}
````

#### A Team's Roster with Season Stats

```json
{
    "dataType": "rosters",
    "teams": ["Los Angeles Dodgers"],
    "season": 2025,
    "includeStats": true
}
```

#### Wild-Card Standings

```json
{
    "dataType": "standings",
    "standingsType": "wildCard",
    "season": 2025
}
```

#### Player Bios and Stats

```json
{
    "dataType": "players",
    "players": ["Shohei Ohtani", "Aaron Judge"],
    "season": 2025,
    "includeStats": true
}
```

#### World Series Games in a Date Range

```json
{
    "dataType": "games",
    "season": 2024,
    "startDate": "2024-10-25",
    "endDate": "2024-10-31",
    "gameType": "W"
}
```

### Input Reference

#### What to Extract

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `dataType` | select | `Games — schedules, scores & matchups` | Choose the kind of MLB data: Games, Teams, Rosters, Players, or Standings. |

#### Filters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `teams` | string\[] | `["New York Yankees"]` | Team names (e.g. "New York Yankees"), abbreviations (e.g. "NYY"), team IDs, or mlb.com team links. Picks which teams' rosters to fetch and narrows games and standings. Leave empty for all 30 teams. |
| `players` | string\[] | `[]` | Player names (e.g. "Shohei Ohtani"), player IDs, or mlb.com player links. Applies to the Players data type. |
| `season` | integer | `2026` | The season year to collect, e.g. 2025. Applies to all data types. |
| `startDate` | string | `""` | Collect games on or after this date (YYYY-MM-DD). Leave empty to use today. Games only. |
| `endDate` | string | `""` | Collect games on or before this date (YYYY-MM-DD). Leave empty to match the start date. Games only. |
| `gameType` | select | `All game types` | Limit to one game type: Regular Season, Wild Card, Division Series, League Championship, World Series, or Spring Training. Applies to Games. |
| `standingsType` | select | `Division standings` | How to group standings: Division standings, League standings, Wild Card standings, or Wild Card with division leaders. Standings only. |

#### Output Detail

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `includeStats` | boolean | `true` | For Rosters and Players, also fetch each player's season stats. Turn off for faster, cheaper runs that return only roster and bio information. No effect on Games, Teams, or Standings. |

#### Limits

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `maxResults` | integer | `100` | How many records to collect in total. Set to 0 to collect as many as possible. Standings and Teams always return their full fixed set. |

### Output

Each row carries a `recordType` field identifying which of the five data types it is. Examples and field tables for each type follow.

#### Games (`recordType: "game"`)

```json
{
    "recordType": "game",
    "gamePk": 775296,
    "gameDate": "2024-10-30T00:08:00Z",
    "officialDate": "2024-10-30",
    "gameType": "World Series",
    "season": 2024,
    "status": "Final",
    "seriesDescription": "World Series",
    "homeTeam": {
        "id": 147,
        "name": "New York Yankees",
        "abbreviation": "NYY",
        "score": 5,
        "isWinner": false,
        "leagueRecord": { "wins": 1, "losses": 4, "pct": ".200" }
    },
    "awayTeam": {
        "id": 119,
        "name": "Los Angeles Dodgers",
        "abbreviation": "LAD",
        "score": 7,
        "isWinner": true,
        "leagueRecord": { "wins": 4, "losses": 1, "pct": ".800" }
    },
    "venue": { "id": 3313, "name": "Yankee Stadium" },
    "dayNight": "night",
    "doubleHeader": "N",
    "scheduledInnings": 9,
    "linescore": { "currentInning": 9, "teams": { "home": { "runs": 5, "hits": 8, "errors": 0 }, "away": { "runs": 7, "hits": 9, "errors": 1 } } },
    "decisions": { "winner": { "id": 621111, "fullName": "Walker Buehler" }, "loser": { "id": 543037, "fullName": "Gerrit Cole" } },
    "url": "https://www.mlb.com/gameday/775296",
    "scrapedAt": "2026-07-01T14:30:00Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `recordType` | string | Always "game" |
| `gamePk` | integer | Unique game identifier |
| `gameDate` | string | Game start time (UTC) |
| `officialDate` | string | Calendar date (YYYY-MM-DD) |
| `gameType` | string | Full label, e.g. "Regular Season", "World Series" |
| `season` | integer | Season year |
| `status` | string | Game status, e.g. Final, Scheduled, In Progress |
| `seriesDescription` | string | Series name, e.g. "Regular Season", "World Series" |
| `homeTeam` / `awayTeam` | object | Team id, name, abbreviation, score, isWinner, and league record |
| `venue` | object | Ballpark id and name |
| `dayNight` | string | "day" or "night" |
| `doubleHeader` | string | Doubleheader flag: N (none), Y (traditional), or S (split) |
| `scheduledInnings` | integer | Scheduled innings, usually 9 |
| `linescore` | object | Current inning and per-team runs, hits, and errors |
| `decisions` | object | Winning, losing, and save pitchers |
| `url` | string | mlb.com Gameday link |
| `scrapedAt` | string | Extraction timestamp |

#### Teams (`recordType: "team"`)

```json
{
    "recordType": "team",
    "id": 147,
    "name": "New York Yankees",
    "abbreviation": "NYY",
    "teamCode": "nya",
    "fileCode": "nyy",
    "league": { "id": 103, "name": "American League" },
    "division": { "id": 201, "name": "American League East" },
    "venue": { "id": 3313, "name": "Yankee Stadium" },
    "firstYearOfPlay": "1903",
    "locationName": "Bronx",
    "url": "https://www.mlb.com/team/147",
    "scrapedAt": "2026-07-01T14:30:00Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `recordType` | string | Always "team" |
| `id` | integer | Team identifier |
| `name` | string | Full club name |
| `abbreviation` | string | Short code, e.g. NYY |
| `teamCode` / `fileCode` | string | Internal team codes |
| `league` | object | League id and name (AL or NL) |
| `division` | object | Division id and name |
| `venue` | object | Home ballpark id and name |
| `firstYearOfPlay` | string | First year the franchise played |
| `locationName` | string | Home city or borough |
| `url` | string | mlb.com team page |
| `scrapedAt` | string | Extraction timestamp |

#### Rosters (`recordType: "rosterPlayer"`)

```json
{
    "recordType": "rosterPlayer",
    "teamId": 119,
    "teamName": "Los Angeles Dodgers",
    "playerId": 660271,
    "fullName": "Shohei Ohtani",
    "jerseyNumber": "17",
    "position": { "code": "10", "name": "Designated Hitter", "abbreviation": "DH" },
    "status": "Active",
    "stats": { "hitting": { "homeRuns": 54, "avg": ".310", "obp": ".390", "slg": ".646", "ops": "1.036", "rbi": 130 } },
    "url": "https://www.mlb.com/player/660271",
    "scrapedAt": "2026-07-01T14:30:00Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `recordType` | string | Always "rosterPlayer" |
| `teamId` / `teamName` | integer / string | Team the roster belongs to |
| `playerId` | integer | Player identifier |
| `fullName` | string | Player name |
| `jerseyNumber` | string | Uniform number |
| `position` | object | Position code, name, and abbreviation |
| `status` | string | Roster status, e.g. Active |
| `stats` | object | Season hitting, pitching, and fielding stats (when includeStats is on) |
| `url` | string | mlb.com player page |
| `scrapedAt` | string | Extraction timestamp |

#### Players (`recordType: "player"`)

```json
{
    "recordType": "player",
    "id": 660271,
    "fullName": "Shohei Ohtani",
    "primaryNumber": "17",
    "currentTeam": { "id": 119, "name": "Los Angeles Dodgers" },
    "primaryPosition": { "code": "10", "name": "Designated Hitter", "abbreviation": "DH" },
    "birthDate": "1994-07-05",
    "currentAge": 30,
    "birthCity": "Oshu",
    "birthCountry": "Japan",
    "height": "6' 4\"",
    "weight": 210,
    "batSide": "Left",
    "pitchHand": "Right",
    "mlbDebutDate": "2018-03-29",
    "active": true,
    "stats": { "hitting": { "homeRuns": 54, "avg": ".310", "ops": "1.036", "rbi": 130 }, "pitching": { "era": "3.14", "strikeOuts": 167 } },
    "url": "https://www.mlb.com/player/660271",
    "scrapedAt": "2026-07-01T14:30:00Z"
}
```

**Bio fields**

| Field | Type | Description |
|-------|------|-------------|
| `recordType` | string | Always "player" |
| `id` | integer | Player identifier |
| `fullName` | string | Player name |
| `primaryNumber` | string | Uniform number |
| `currentTeam` | object | Current team id and name |
| `primaryPosition` | object | Position code, name, and abbreviation |
| `birthDate` | string | Date of birth (YYYY-MM-DD) |
| `currentAge` | integer | Current age |
| `birthCity` / `birthCountry` | string | Birthplace |
| `height` / `weight` | string / integer | Listed height and weight |
| `batSide` / `pitchHand` | string | Bats and throws |
| `mlbDebutDate` | string | MLB debut date |
| `active` | boolean | Currently active |
| `url` | string | mlb.com player page |
| `scrapedAt` | string | Extraction timestamp |
| `stats` | object | Season stats (when includeStats is on) — see below |

**Stats block** (present when `includeStats` is on)

| Field | Type | Description |
|-------|------|-------------|
| `stats.hitting` | object | Hitting line: homeRuns, avg, obp, slg, ops, rbi, and more |
| `stats.pitching` | object | Pitching line: era, strikeOuts, wins, saves, whip, and more |
| `stats.fielding` | object | Fielding line by position |

#### Standings (`recordType: "standing"`)

```json
{
    "recordType": "standing",
    "season": 2025,
    "league": { "id": 103, "name": "American League" },
    "division": { "id": 201, "name": "American League East" },
    "team": { "id": 147, "name": "New York Yankees" },
    "wins": 94,
    "losses": 68,
    "winningPercentage": ".580",
    "gamesBack": "-",
    "wildCardGamesBack": "-",
    "divisionRank": "1",
    "leagueRank": "2",
    "wildCardRank": "-",
    "streak": "W3",
    "runsScored": 815,
    "runsAllowed": 668,
    "runDifferential": 147,
    "clinched": true,
    "scrapedAt": "2026-07-01T14:30:00Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `recordType` | string | Always "standing" |
| `season` | integer | Season year |
| `league` | object | League id and name |
| `division` | object | Division id and name |
| `team` | object | Team id and name |
| `wins` / `losses` | integer | Wins and losses |
| `winningPercentage` | string | Win percentage |
| `gamesBack` | string | Games behind the division leader |
| `wildCardGamesBack` | string | Games behind the wild-card cutoff |
| `divisionRank` / `leagueRank` / `wildCardRank` | string | Rank within division, league, and wild-card race |
| `streak` | string | Current streak, e.g. "W3" |
| `runsScored` / `runsAllowed` / `runDifferential` | integer | Run totals and differential |
| `clinched` | boolean | Playoff berth clinched |
| `scrapedAt` | string | Extraction timestamp |

### Tips for Best Results

- **Leave the dates blank for today's slate** — an empty start and end date returns the current day's games with live status and scores.
- **Keep a games date range inside one season** — for postseason, set `gameType` to World Series (or Division Series, League Championship) and pin the date range to October of that year to isolate the exact series.
- **Turn off `includeStats` for speed** — roster and player runs skip the extra stat fetch per player, so you get names, positions, and bios much faster and cheaper when you don't need full stat lines.
- **Name teams however you like** — full name, abbreviation, team ID, or a mlb.com team URL all work; leave `teams` empty to pull all 30 clubs at once.
- **Use the Players type for star tracking, Rosters for whole clubs** — Players takes an explicit name/ID list, while Rosters pulls every active player on the teams you pick.
- **Pick `wildCardWithLeaders` for a full playoff-picture snapshot** — it adds each division leader alongside the wild-card contenders in one standings pull.
- **Set `season` to any year back to 1876** — historical schedules, rosters, and standings are all available for deep multi-season research.

### Pricing

**From $20.00 per 1,000 results** — a flat, predictable rate whether you pull games, standings, rosters, or full player stat lines. Bronze, Silver, and Gold subscribers pay progressively less; the table below shows total cost at each discount tier.

| Results | No discount | Bronze | Silver | Gold |
|---------|-------------|--------|--------|------|
| 100 | $2.40 | $2.26 | $2.13 | $2.00 |
| 1,000 | $24.00 | $22.60 | $21.30 | $20.00 |
| 10,000 | $240.00 | $226.00 | $213.00 | $200.00 |
| 100,000 | $2,400.00 | $2,260.00 | $2,130.00 | $2,000.00 |

A "result" is any row in the output dataset — one game, team, roster player, player, or standings entry. No compute or time-based charges — you pay per result, plus a small fixed per-run start fee. Platform fees depend on your Apify plan.

### Integrations

Export data in JSON, CSV, Excel, XML, or RSS. Connect to 1,500+ apps via:

- **Zapier** / **Make** / **n8n** — Workflow automation
- **Google Sheets** — Direct spreadsheet export
- **Slack** / **Email** — Notifications on new results
- **Webhooks** — Trigger custom APIs on run completion
- **Apify API** — Full programmatic access

### Legal & Ethical Use

This actor is designed for legitimate sports research, analytics, journalism, and data products using publicly available Major League Baseball information. You are responsible for complying with applicable laws and the terms of service of the sources involved. Do not use extracted data for any unlawful purpose, and respect all applicable trademarks and intellectual property rights. </content> </invoke>

# Actor input Schema

## `dataType` (type: `string`):

Choose the kind of MLB data you want. Games returns schedules with scores and matchups. Teams returns all 30 clubs with league, division, and venue. Rosters returns each team's active roster. Players returns player bios and season stats. Standings returns division, league, or wild-card standings.

## `teams` (type: `array`):

Team names (e.g. "New York Yankees"), abbreviations (e.g. "NYY"), team IDs, or mlb.com team page links. Used to pick which teams' Rosters to fetch, and to narrow Games and Standings to specific clubs. Leave empty to include all 30 teams.

## `players` (type: `array`):

Player names (e.g. "Shohei Ohtani"), player IDs, or mlb.com player page links. Applies to the Players data type. Leave empty to fetch all players on the selected teams' rosters instead.

## `season` (type: `integer`):

The season year to collect, for example 2025. Leave at the current year for the latest season. Applies to all data types.

## `startDate` (type: `string`):

Collect games on or after this date. Use the format YYYY-MM-DD, for example 2025-05-15. Leave empty to use today. Applies to the Games data type only.

## `endDate` (type: `string`):

Collect games on or before this date. Use the format YYYY-MM-DD. Leave empty to match the start date (a single day). Applies to the Games data type only.

## `gameType` (type: `string`):

Only include games of this type. Leave as "All game types" to include everything. Applies to the Games data type.

## `standingsType` (type: `string`):

How to group the standings. Division shows each division's table, League ranks all teams in each league, Wild Card shows the wild-card race, and Wild Card with leaders adds the division leaders to that view. Applies to the Standings data type only.

## `includeStats` (type: `boolean`):

For Rosters and Players, also fetch each player's season stats (hitting, pitching, and fielding). Turn this off for faster, cheaper runs that return only the roster and bio information. Has no effect on Games, Teams, or Standings.

## `maxResults` (type: `integer`):

How many records to collect in total across all filters. Default 100. Set to 0 to collect as many as possible (up to a safety ceiling). You'll get at most this many — fewer when the source has fewer. Rosters are collected team by team and stop once this total is reached. Standings and Teams always return their full fixed set regardless of this value.

## Actor input object example

```json
{
  "dataType": "games",
  "teams": [
    "New York Yankees"
  ],
  "players": [],
  "season": 2026,
  "gameType": "",
  "standingsType": "byDivision",
  "includeStats": true,
  "maxResults": 100
}
```

# Actor output Schema

## `overview` (type: `string`):

Table of scraped results with key fields.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "dataType": "games",
    "teams": [
        "New York Yankees"
    ],
    "players": [],
    "season": 2026,
    "startDate": "",
    "endDate": "",
    "gameType": "",
    "standingsType": "byDivision",
    "includeStats": true,
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("solidcode/mlb-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "dataType": "games",
    "teams": ["New York Yankees"],
    "players": [],
    "season": 2026,
    "startDate": "",
    "endDate": "",
    "gameType": "",
    "standingsType": "byDivision",
    "includeStats": True,
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("solidcode/mlb-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "dataType": "games",
  "teams": [
    "New York Yankees"
  ],
  "players": [],
  "season": 2026,
  "startDate": "",
  "endDate": "",
  "gameType": "",
  "standingsType": "byDivision",
  "includeStats": true,
  "maxResults": 100
}' |
apify call solidcode/mlb-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=solidcode/mlb-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "MLB Scraper",
        "description": "[💰 $20 / 1K] Extract MLB games, teams, rosters, players, and standings — scores, schedules, matchups, player bios and season stats, and division and wild-card standings. Pick clubs by name or abbreviation, filter by season and game type.",
        "version": "1.0",
        "x-build-id": "ihZCMpu538KtCpdCT"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/solidcode~mlb-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-solidcode-mlb-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/solidcode~mlb-scraper/runs": {
            "post": {
                "operationId": "runs-sync-solidcode-mlb-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/solidcode~mlb-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-solidcode-mlb-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "dataType": {
                        "title": "What to extract",
                        "enum": [
                            "games",
                            "teams",
                            "rosters",
                            "players",
                            "standings"
                        ],
                        "type": "string",
                        "description": "Choose the kind of MLB data you want. Games returns schedules with scores and matchups. Teams returns all 30 clubs with league, division, and venue. Rosters returns each team's active roster. Players returns player bios and season stats. Standings returns division, league, or wild-card standings.",
                        "default": "games"
                    },
                    "teams": {
                        "title": "Teams",
                        "type": "array",
                        "description": "Team names (e.g. \"New York Yankees\"), abbreviations (e.g. \"NYY\"), team IDs, or mlb.com team page links. Used to pick which teams' Rosters to fetch, and to narrow Games and Standings to specific clubs. Leave empty to include all 30 teams.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "players": {
                        "title": "Players",
                        "type": "array",
                        "description": "Player names (e.g. \"Shohei Ohtani\"), player IDs, or mlb.com player page links. Applies to the Players data type. Leave empty to fetch all players on the selected teams' rosters instead.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "season": {
                        "title": "Season (year)",
                        "minimum": 1876,
                        "maximum": 2100,
                        "type": "integer",
                        "description": "The season year to collect, for example 2025. Leave at the current year for the latest season. Applies to all data types.",
                        "default": 2026
                    },
                    "startDate": {
                        "title": "Games from date",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Collect games on or after this date. Use the format YYYY-MM-DD, for example 2025-05-15. Leave empty to use today. Applies to the Games data type only."
                    },
                    "endDate": {
                        "title": "Games up to date",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Collect games on or before this date. Use the format YYYY-MM-DD. Leave empty to match the start date (a single day). Applies to the Games data type only."
                    },
                    "gameType": {
                        "title": "Game type",
                        "enum": [
                            "",
                            "R",
                            "F",
                            "D",
                            "L",
                            "W",
                            "S"
                        ],
                        "type": "string",
                        "description": "Only include games of this type. Leave as \"All game types\" to include everything. Applies to the Games data type.",
                        "default": ""
                    },
                    "standingsType": {
                        "title": "Standings grouping",
                        "enum": [
                            "byDivision",
                            "byLeague",
                            "wildCard",
                            "wildCardWithLeaders"
                        ],
                        "type": "string",
                        "description": "How to group the standings. Division shows each division's table, League ranks all teams in each league, Wild Card shows the wild-card race, and Wild Card with leaders adds the division leaders to that view. Applies to the Standings data type only.",
                        "default": "byDivision"
                    },
                    "includeStats": {
                        "title": "Include season stats",
                        "type": "boolean",
                        "description": "For Rosters and Players, also fetch each player's season stats (hitting, pitching, and fielding). Turn this off for faster, cheaper runs that return only the roster and bio information. Has no effect on Games, Teams, or Standings.",
                        "default": true
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 0,
                        "type": "integer",
                        "description": "How many records to collect in total across all filters. Default 100. Set to 0 to collect as many as possible (up to a safety ceiling). You'll get at most this many — fewer when the source has fewer. Rosters are collected team by team and stop once this total is reached. Standings and Teams always return their full fixed set regardless of this value.",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
