# Flashscore Baseball Scraper - Scores, Innings & Line Scores (`clearfetch/flashscore-baseball-scraper`) Actor

Scrape baseball games from Flashscore: fixtures, live scores, final results, the full inning-by-inning line score and match statistics. MLB, NPB, KBO and every domestic league. No proxy, no login.

- **URL**: https://apify.com/clearfetch/flashscore-baseball-scraper.md
- **Developed by:** [Nada Hanad](https://apify.com/clearfetch) (community)
- **Categories:** Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 games

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Flashscore Baseball Scraper - Scores, Innings & Line Scores

Baseball results from Flashscore as clean JSON: fixtures for the days you choose, live scores, final results, and
the complete inning-by-inning line score for every game. MLB, NPB, KBO and the domestic leagues below them. No
login, no API key and no proxy. **$0.001 per game.**

### What data you get

- **The full line score.** One entry per inning with the runs scored in it, and they reconcile with the final
  total, which the test suite asserts on every finished game rather than assuming.
- **An unbatted final inning is marked, not zeroed.** When the home team is ahead and never bats in the ninth,
  the feed says `X` and so does this Actor: `home: null, notBatted: true`. Reporting a 0 there would quietly
  corrupt any per-inning analysis you build on it.
- **Status from Flashscore's own stage codes**, so a game in the seventh reads as live, plus `stageDetail`
  naming the exact stage such as `SEVENTH_INNING` or `EXTRA_INNING`.
- **Teams and competition** with IDs, three-letter codes, logos and the Flashscore URL.
- **`raw`**: all 57 original feed fields, so nothing is lost if you need something not mapped above.

### How to use

1. Choose the days to fetch (`0` for today, `-1` for yesterday), then optionally filter countries or competitions.
2. Run the Actor in matches mode for scores and results, or use matchDetails with match IDs for detailed baseball data.
3. Open the dataset to review the games, then export JSON, CSV or Excel, or retrieve the results through the API.

### Output example

A game where the home team took the lead and never batted in the ninth:

```json
{
  "matchId": "SCvI5Ra5",
  "url": "https://www.flashscore.com/match/SCvI5Ra5/",
  "sport": "baseball",
  "status": "finished",
  "stage": "finished",
  "stageDetail": "FINISHED",
  "stageCode": 3,
  "stageDetailCode": 3,
  "startTime": "2026-09-04T14:00:00.000Z",
  "lastUpdate": "2026-09-04T17:06:50.000Z",
  "note": null,
  "tournament": {
    "name": "Extraliga",
    "fullName": "CZECH REPUBLIC: Extraliga - Play Offs",
    "country": "Czech Republic",
    "phase": "Play Offs",
    "id": "CGQXGxlC",
    "stageId": "IynvQfzT",
    "path": "/baseball/czech-republic/extraliga/",
    "url": "https://www.flashscore.com/baseball/czech-republic/extraliga/"
  },
  "home": {
    "name": "Kotlarka Prague",
    "fullName": "Kotlarka Prague",
    "id": "YT9IySyA",
    "slug": "kotlarka-prague",
    "url": "https://www.flashscore.com/team/kotlarka-prague/YT9IySyA/",
    "code": "KPR",
    "image": "https://static.flashscore.com/res/image/data/MqhqrJA6-KpjmilWG.png"
  },
  "away": {
    "name": "Hrosi Brno",
    "fullName": "Hrosi Brno",
    "id": "tfDQZ56M",
    "slug": "hrosi-brno",
    "url": "https://www.flashscore.com/team/hrosi-brno/tfDQZ56M/",
    "code": "HBR",
    "image": "https://static.flashscore.com/res/image/data/WdB8doVH-l4zuNCEt.png"
  },
  "score": {
    "home": 8,
    "away": 6,
    "innings": [
      {
        "inning": 1,
        "home": 0,
        "away": 0,
        "notBatted": false
      },
      {
        "inning": 2,
        "home": 0,
        "away": 0,
        "notBatted": false
      },
      {
        "inning": 3,
        "home": 1,
        "away": 0,
        "notBatted": false
      },
      {
        "inning": 4,
        "home": 2,
        "away": 1,
        "notBatted": false
      },
      {
        "inning": 5,
        "home": 0,
        "away": 1,
        "notBatted": false
      },
      {
        "inning": 6,
        "home": 3,
        "away": 0,
        "notBatted": false
      },
      {
        "inning": 7,
        "home": 0,
        "away": 4,
        "notBatted": false
      },
      {
        "inning": 8,
        "home": 2,
        "away": 0,
        "notBatted": false
      },
      {
        "inning": 9,
        "home": null,
        "away": 0,
        "notBatted": true
      }
    ]
  },
  "winner": "home",
  "inPlay": false,
  "ok": true,
  "dayOffset": -1,
  "scrapedAt": "2026-09-05T19:21:46.730Z"
}
```

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | string | `matches` | `matches` for fixtures, live scores and results; `matchDetails` for inning scores, statistics and head to head. |
| `days` | array | `["0"]` | Day offsets from today, from -7 to 7. Note that a night game in the Americas lands on the following UTC day. |
| `status` | array | all | `scheduled`, `live`, `finished`, `postponed`, `cancelled` or `interrupted`. |
| `countries` | array | all | For example USA, Japan, South Korea. |
| `tournamentFilter` | string | — | Case-insensitive regular expression on the competition name, e.g. `mlb`. |
| `matchIds` | array | — | Details mode: match IDs or full `flashscore.com/match/...` URLs. |
| `details` | array | all three | Details mode: `summary`, `statistics`, `h2h`. |
| `maxItems` | integer | `0` | Stop after this many rows; 0 means no limit. |
| `maxConcurrency` | integer | `5` | Parallel requests in details mode. |
| `timeoutSecs` | integer | `30` | Per-request timeout. |
| `proxyConfiguration` | object | off | Optional. Not needed in normal use. |

### Pricing

**$0.001 per game**, and **$0.01 per game** in details mode however many sections you request. A full day across
every league is a few hundred games, so under a dollar. Games that fail or have no data are free.

Paid Apify plans pay less: 10% off on Bronze, 20% on Silver and 30% on Gold and higher tiers.

Apify also charges a run-start fee of $0.00005 per started GB of allocated memory (minimum one event), including runs that produce no chargeable results.

### Use cases

- **Modelling and sabermetrics**: per-inning run distributions across leagues and seasons, including the games
  most feeds flatten by reporting an unbatted ninth as a zero.
- **Live scoreboards and bots**: poll for in-progress scores and push updates.
- **Fantasy and prediction games**: populate fixtures and settle results.
- **Media**: daily results digests with the line score.
- **AI agents**: a tool that answers "how did last night's games finish, inning by inning".

### Integrations

```bash
curl -X POST "https://api.apify.com/v2/acts/clearfetch~flashscore-baseball-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"days": ["-1"], "countries": ["USA"]}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("clearfetch/flashscore-baseball-scraper").call(run_input={"days": ["-1"]})

for game in client.dataset(run["defaultDatasetId"]).iterate_items():
    line = " ".join("X" if i["notBatted"] else str(i["home"]) for i in game["score"]["innings"] or [])
    print(game["home"]["name"], game["score"]["home"], "-", game["score"]["away"], game["away"]["name"], line)
```

Works with the Apify integrations for n8n, Make, Zapier, Google Sheets, Slack and webhooks, with scheduled runs,
and with AI agents through the Apify MCP server.

### FAQ

**Do the innings always add up?** Yes, and it is asserted on every finished game in the test set rather than
assumed. If a game ever fails that check, it means the feed changed and I want to know.

**Why is an inning null instead of 0?** Because the home team did not bat in it. A zero would say they batted and
failed to score, which is a different fact and would skew any per-inning statistic.

**Do I need a proxy?** No. A proxy input exists for completeness.

**Is this legal?** It reads the same public endpoints a browser reads, with no login and no personal data. Scores
are facts. What you do with the data, including redistribution, is your responsibility.

### More tools from clearfetch

- [Flashscore Football Scraper](https://apify.com/clearfetch/flashscore-football-scraper): fixtures, live scores and results from every league
- [Flashscore Tennis Scraper](https://apify.com/clearfetch/flashscore-tennis-scraper): ATP, WTA and Challenger matches with point by point
- [Flashscore Basketball Scraper](https://apify.com/clearfetch/flashscore-basketball-scraper): NBA, EuroLeague and every league, by quarter
- [Flashscore Hockey Scraper](https://apify.com/clearfetch/flashscore-hockey-scraper): NHL, KHL and every league, by period

### Changelog

- **1.0.1** (2026-09) — match links copied from the browser work in details mode. Flashscore's current links
  carry the match ID in `?mid=`, after team names that were being read as the ID; a link with no ID in it is now
  skipped with a message saying where to find one.
- **1.0.0** (2026-09) — first release: games mode with day ranges and filters, full line scores with unbatted
  innings preserved, details mode with statistics and head to head, status from Flashscore's own stage codes.

# Actor input Schema

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

"Games" returns one row per game for the days you choose. "Game details" takes match IDs and returns inning scores, statistics and head-to-head for each one.

## `days` (type: `array`):

Which days to cover, as offsets from today: 0 is today, -1 yesterday, 1 tomorrow. Range -7 to 7. Add several entries to cover a range in one run.

## `status` (type: `array`):

Keep only games in these states. Leave empty for all. Status is resolved from Flashscore's own stage codes, so a game in the seventh inning counts as live.

## `countries` (type: `array`):

Keep only competitions from these countries or regions, for example USA, Japan, Czech Republic. Case-insensitive. Leave empty for all.

## `tournamentFilter` (type: `string`):

Optional case-insensitive regular expression matched against the full competition name, for example "mlb" or "npb|kbo".

## `matchIds` (type: `array`):

Match IDs such as "8pDcRPQq", or full flashscore.com/match/... URLs. Only used in game details mode.

## `details` (type: `array`):

Sections to fetch per game. Leave empty for all three. Each game is charged once no matter how many sections you pick.

## `maxItems` (type: `integer`):

Stop after this many rows. 0 means no limit.

## `maxConcurrency` (type: `integer`):

Parallel requests in details mode.

## `timeoutSecs` (type: `integer`):

Give up on a single feed request after this many seconds.

## `token` (type: `string`):

Advanced. The Actor discovers Flashscore's feed signature automatically and falls back to a known value. Set this only if both stop working and you have a current signature.

## `proxyConfiguration` (type: `object`):

Optional. The feed answers plain datacenter requests, so no proxy is needed in normal use.

## Actor input object example

```json
{
  "mode": "matches",
  "days": [
    "0"
  ],
  "status": [],
  "countries": [],
  "matchIds": [],
  "details": [],
  "maxItems": 0,
  "maxConcurrency": 5,
  "timeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

In games mode, one row per game: status, first-pitch time, competition with country, both teams, final runs and the full inning-by-inning line score, with an unbatted final inning marked rather than reported as a zero. In game details mode, one row per game with inning scores, statistics and head-to-head. Games with no data appear with ok=false and are not charged.

# 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 = {
    "days": [
        "0"
    ],
    "countries": [],
    "matchIds": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearfetch/flashscore-baseball-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 = {
    "days": ["0"],
    "countries": [],
    "matchIds": [],
}

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

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

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

```

## CLI example

```bash
echo '{
  "days": [
    "0"
  ],
  "countries": [],
  "matchIds": []
}' |
apify call clearfetch/flashscore-baseball-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,clearfetch/flashscore-baseball-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ua6BxATClBIBDZPXp/builds/EBexGqVXCGwmMbU4a/openapi.json
