# MLB Player Stats, Scores & Standings Scraper (`scrapers_lat/mlb-stats-scraper`) Actor

Scrape MLB teams, rosters, player season stats, schedules, final scores and division standings from the official MLB Stats API. Covers all 30 Major League Baseball clubs with wins, losses, runs and records. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/scrapers\_lat/mlb-stats-scraper.md
- **Developed by:** [Scrapers Lat](https://apify.com/scrapers_lat) (community)
- **Categories:** Sports, Automation, Developer tools
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $6.15 / 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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Player Stats, Scores & Standings Scraper](https://scrapers.lat/banners/mlb-stats-scraper.png)](https://console.apify.com/actors/LqUmdZpZ1LLHuXuOO/input)

## MLB Player Stats, Scores & Standings Scraper

> Extract MLB teams, rosters, player season stats, schedules with final scores and probable starting pitchers, and division standings with playoff magic and elimination numbers from the official MLB Stats API covering all 30 Major League Baseball clubs.

**📥 [Input](https://apify.com/scrapers_lat/mlb-stats-scraper/input-schema) · 📤 [Output](https://apify.com/scrapers_lat/mlb-stats-scraper/output-schema) · 💰 [Pricing](https://apify.com/scrapers_lat/mlb-stats-scraper/pricing) · ▶️ [Examples](https://apify.com/scrapers_lat/mlb-stats-scraper/examples)**

![Apify](https://img.shields.io/badge/Platform-Apify-1CE1CE?logo=apify\&logoColor=white)
![Coverage](https://img.shields.io/badge/Coverage-30%20MLB%20teams-blue)
![Maintained](https://img.shields.io/badge/Maintained-Yes-brightgreen)
![Output](https://img.shields.io/badge/Output-JSON%20%7C%20CSV%20%7C%20Excel-orange)

<table><tr>
<td align="center"><strong>5 modes</strong><br>teams, roster, players, schedule, standings</td>
<td align="center"><strong>30 teams</strong><br>full coverage</td>
<td align="center"><strong>JSON / CSV / Excel</strong><br>output formats</td>
</tr></table>

<br>

### Who is it for

| Use case | Who benefits |
|---|---|
| Fantasy baseball tools | Developers building draft and lineup apps |
| Sports analytics | Analysts modeling team and player performance |
| Betting and odds models | Quant teams needing clean historical results |
| Media and content | Writers and sites pulling standings and box scores |
| Data pipelines | Engineers feeding dashboards and BI tools |

### Frequently Asked Questions

**How do I get a specific team's full roster with stats?**\
Choose roster mode, select the team from the dropdown, set the season, and keep Include Player Stats enabled. Each player record comes back with a full bio plus a hitting or pitching season stat line, picked automatically based on position.

**Can I pull standings for past seasons?**\
Yes. Standings mode accepts any season year and league (American, National, or both) and returns one record per team with wins, losses, division and wild-card ranks, games back, run differential, streak, and the playoff race fields: magic number, elimination number, wild-card elimination number, and clinch flags for division leader, division champion and wild card.

**How do I get final scores for a given day?**\
Use schedule mode and set the date in YYYY-MM-DD format. You get one record per game with home and away scores, the winner flag, venue, status, and the announced home and away probable starting pitchers for upcoming games.

**Where do I find player IDs for players mode?**\
Run teams or roster mode first. Every team and player record includes its MLB ID, which you paste into the Player IDs list for players mode.

**Does this need an API key or login?**\
No. It reads public MLB Stats API data and runs over the Apify Proxy for reliable access, with no key or account required.

***

This is an independent tool that collects publicly available data from the MLB Stats API for research and analysis. It is not affiliated with, endorsed by, or sponsored by Major League Baseball or MLB Advanced Media. All team names, player names, and statistics are the property of their respective owners.

### Example use cases

Ready-to-run example tasks, each preconfigured for a common scenario. Open one and press run, or use it as a template:

- [MLB League Standings (2025 Season)](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-league-standings-2025): MLB League Standings (2025 Season)
- [New York Yankees 2025 Roster with Hitting Stats](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-yankees-2025-roster-stats): New York Yankees 2025 Roster with Hitting Stats
- [LA Dodgers 2025 Pitching Roster and Stats](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-dodgers-2025-pitching-roster): LA Dodgers 2025 Pitching Roster and Stats
- [Shohei Ohtani 2025 Season Hitting Stats](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-shohei-ohtani-season-stats): Shohei Ohtani 2025 Season Hitting Stats
- [American League Standings 2025 by Division](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-american-league-standings-2025): American League Standings 2025 by Division
- [MLB Schedule and Scores July 4 2025](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-schedule-july-4-2025-scores): MLB Schedule and Scores July 4 2025
- [All 30 MLB Teams Directory 2025](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-all-30-teams-directory): All 30 MLB Teams Directory 2025
- [National League Standings 2025 by Division](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-national-league-standings-2025): National League Standings 2025 by Division
- [Boston Red Sox 2025 Roster with Hitting Stats](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-red-sox-2025-roster-stats): Boston Red Sox 2025 Roster with Hitting Stats
- [Aaron Judge 2025 Season Hitting Stats](https://apify.com/scrapers_lat/mlb-stats-scraper/examples/mlb-aaron-judge-2025-hitting-stats): Aaron Judge 2025 Season Hitting Stats

### Export, API and AI agents (x402 + MCP)

Export the scraped data to **JSON, CSV or Excel**, pull it as a **dataset** through the Apify **API**, or wire it into your app with **no code**. This web scraper and data extractor also works for bulk data extraction and scheduled runs.

For AI agents: this Actor is available on **x402**, Apify's agentic payment standard built with Coinbase. An AI agent can discover, pay for and run it on its own with a funded wallet and a single HTTP request: no account, no subscription, no API key and no human in the loop. It also runs as an **MCP** tool inside Claude, Cursor and other AI clients out of the box. Learn more about [x402 agentic payments on Apify](https://docs.apify.com/platform/integrations/x402).

### Related scrapers

Need data from the same space? Here are other scrapers we build and maintain:

- [SEC EDGAR Company Filings Scraper](https://apify.com/scrapers_lat/sec-edgar-filings-scraper): Scrape SEC EDGAR company filings by ticker or CIK. Get form type, filing date, accession number...
- [USAspending Federal Award Scraper](https://apify.com/scrapers_lat/usaspending-awards-scraper): Scrape US federal prime awards from USAspending.gov. Get recipient, UEI, award amount, awarding...
- [openFDA Drug Events & Recalls Scraper](https://apify.com/scrapers_lat/openfda-drug-events-scraper): Scrape FDA drug adverse event reports (FAERS) and drug recall and enforcement actions from the...
- [OFAC Sanctions List Scraper](https://apify.com/scrapers_lat/ofac-sanctions-scraper): Download and parse the US Treasury OFAC SDN and Consolidated sanctions lists. Get each sanctioned...
- [Grants.gov Opportunity Scraper](https://apify.com/scrapers_lat/grants-gov-scraper): Extract U.S. federal grant opportunities from the official Grants.gov API. Scrape title, agency...
- [Federal Register Document Scraper](https://apify.com/scrapers_lat/federal-register-scraper): Search and extract documents from the U.S. Federal Register by keyword, document type, agency and...

### More scrapers at scrapers.lat

This actor is built and maintained by [scrapers.lat](https://scrapers.lat), where we publish scrapers for Latin American and US public platforms: real estate, jobs, e-commerce, company registries and government data. Browse the full catalog, see live sample output for each one, or ask us for a custom scraper at [scrapers.lat](https://scrapers.lat).

# Actor input Schema

## `maxRecords` (type: `integer`):

Maximum number of records to collect. Optional.

## `withDetails` (type: `boolean`):

In roster mode, when enabled the scraper also fetches each player's season hitting or pitching stats and bio (height, weight, bat side, throwing hand, birthplace). Has no effect in other modes.

## `mode` (type: `string`):

What to collect. teams = all 30 MLB clubs. roster = every player on a team. players = profile and season stats for specific players. schedule = games and final scores for a date. standings = division standings for a league and season.

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

Season year (used by teams, roster, players and standings modes). Defaults to the current MLB season when left empty.

## `teamId` (type: `string`):

MLB team whose roster to fetch. Required for roster mode.

## `playerIds` (type: `array`):

MLB player IDs to look up in players mode (one record per player). For example 592450 is Aaron Judge and 660271 is Shohei Ohtani. Find IDs in the output of teams or roster mode.

## `statGroup` (type: `string`):

Which season stat line to attach to each player: hitting or pitching.

## `date` (type: `string`):

Date for schedule mode in YYYY-MM-DD format, for example 2025-07-04. Defaults to today when left empty.

## `leagueId` (type: `string`):

League for standings mode: American League, National League, or both.

## Actor input object example

```json
{
  "maxRecords": 10,
  "withDetails": true,
  "mode": "standings",
  "season": 2025,
  "playerIds": [
    "592450",
    "660271"
  ],
  "statGroup": "hitting",
  "leagueId": "103,104"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "maxRecords": 10,
    "season": 2025,
    "playerIds": [
        "592450",
        "660271"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapers_lat/mlb-stats-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 = {
    "maxRecords": 10,
    "season": 2025,
    "playerIds": [
        "592450",
        "660271",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("scrapers_lat/mlb-stats-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 '{
  "maxRecords": 10,
  "season": 2025,
  "playerIds": [
    "592450",
    "660271"
  ]
}' |
apify call scrapers_lat/mlb-stats-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/LqUmdZpZ1LLHuXuOO/builds/e9aIYtqglxr6ZQdWh/openapi.json
