# Baseball Match Scraper — Scores & Match Intel (`teamkamkod/baseball-match-intel`) Actor

Flashscore Baseball — every match of a day (MLB, NPB, KBO, LIDOM, LVBP…) with status (scheduled/live/finished + inning detail), runs, starting & winning pitchers (records included), league, country, match & team ids, plus optional match-intel: full-time stats, H2H, standings, odds, lineups, venue.

- **URL**: https://apify.com/teamkamkod/baseball-match-intel.md
- **Developed by:** [Team Kamkod](https://apify.com/teamkamkod) (community)
- **Categories:** Sports, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 match-listeds

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?

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

## Baseball Match Scraper — Scores & Match Intel

Baseball scores and full match context from Flashscore, structured for automation and AI agents.

**Match Intel — the full picture per game (flag `enrich: true`).** Turn any game into a complete
report: **full match statistics** (per half/period where leagues report them, plus game totals),
**starting & winning pitchers**, recent form & head-to-head, competition standings, venue/city —
and optional **bookmaker odds comparison** (opt-in via `odds: true`): default markets **1X2, Over/
Under, Asian Handicap** (the live-betting decision markets), more markets selectable via
`oddsMarkets`. Bookmaker ids, handicap/total lines and odds movement included — best-effort:
availability varies by market and region (US/EU datacenter IPs see the widest coverage).

One run returns **every game of a day** (default: today) across 100+ competitions — **MLB, NPB, KBO,
CPBL, internationals and more** — as clean JSON rows, one per game. Browse ±3 days, filter by league
or status. Live games report the current inning (`5th Inning`, `Top 3`…) and running score at scrape
time.

### What you get per game (list mode)

| Field | Example |
|---|---|
| `match_id` | `zkPspYkU` |
| `home` / `away` | `Fukuoka S. Hawks` / `Seibu Lions` |
| `home_team_id` / `away_team_id` | stable ids (join records across days) |
| `status` | `SCHEDULED` · `LIVE` · `FINISHED` · `POSTPONED` … |
| `minute` (live) | `5th Inning` (inning + half where reported) |
| `status_detail` | `EXT` (extra innings) · `DRAW` (NPB ties) |
| `home_score` / `away_score` | runs |
| `pitchers` | raw pitcher line: `Ohtsu R. [FUK] (W, 11-5), Sumida C. [SEI] (L, 9-7)` |
| `country` / `league` / `league_slug` | `japan` / `NPB` / `npb` |
| `match_url` | direct Flashscore link |

### Example input

```json
{
  "matchStatuses": ["finished", "live"],
  "leagues": ["mlb", "npb", "kbo"],
  "enrich": true,
  "odds": true,
  "maxMatches": 100
}
```

### Enrichment blocks (enrich: true)

- `statistics` — game & period statistics rows (hits, errors, batting/pitching lines where the
  source provides them)
- `h2h` — recent form (last N games) + head-to-head meetings between the two teams
- `standings` — competition table when available (incl. Japan's split-season formats)
- venue / city / capacity
- `odds` — opt-in, scheduled/live only, default 3 markets (1X2, Over/Under, Asian Handicap)

### Pricing & notes

- Pay-per-event, **billed per returned game**: list mode pushes one row per game (a 100-game day ≈
  100 **match-listed** events ≈ $0.10). No subscription, no per-run fee.
- Enrichment billed per enriched game as **match-intel**.
- Live games report current inning, score and pitcher line at scrape time.
- Status normalization: `Finished`, `After Extra Innings`, `Postponed`, `Suspended`, NPB `Draw`…
- Odds & statistics availability varies by league and region — graceful nulls, never a crash.

### Call it from an AI agent (MCP)

```text
Use the MCP server: mcp.apify.com?tools=<username>/baseball-match-intel
```

Ask: *"Who is pitching tonight's MLB slate and what are the current scores?"* — the agent runs the actor and reads the dataset.

### Legal

This actor scrapes publicly available data. Use it in compliance with the target website's terms and your local regulations.

# Actor input Schema

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

Which day to list. Leave empty for today. dayOffsets below are relative to this date.

## `dayOffsets` (type: `array`):

Also fetch the days before/after the anchor date. Default: anchor day only.

## `matchStatuses` (type: `array`):

Only return matches in these states. Leave empty for all.

## `leagues` (type: `array`):

Free-text filter (case-insensitive) on league name OR country. Examples: "mlb", "npb", "kbo", "usa", "japan", "korea". Empty = all leagues active that day.

## `maxMatches` (type: `integer`):

Upper limit on the number of matches returned. The full day is parsed; this caps the output.

## `enrich` (type: `boolean`):

Merge per match: timeline of events (goals/cards/subs), full match statistics, recent form + head-to-head, standings when available, venue/referee/TV. Billed as match-intel per enriched match.

## `odds` (type: `boolean`):

Best-effort per-market odds comparison (1X2, Over/Under, Asian Handicap...) from the match odds page, with bookmaker ids and value movement. Depends on your region's availability (some geos show no odds); billed as match-intel events.

## `oddsMarkets` (type: `array`):

Which markets to capture (empty = default core 3: 1x2-odds, over-under, asian-handicap — the fast live-betting set; add double-chance, both-teams-to-score, draw-no-bet, correct-score, ht-ft, odd-even for more depth).

## `pageUrl` (type: `string`):

Override the section to scrape (default: https://www.flashscore.com/football/). Rarely needed.

## Actor input object example

```json
{
  "dayOffsets": [
    "0"
  ],
  "matchStatuses": [],
  "leagues": [],
  "maxMatches": 1000,
  "enrich": false,
  "odds": false,
  "oddsMarkets": []
}
```

# Actor output Schema

## `match_records` (type: `string`):

Dataset of daily match records. Use the 'overview' view.

# 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 = {
    "dayOffsets": [
        "0"
    ],
    "matchStatuses": [],
    "leagues": [],
    "oddsMarkets": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("teamkamkod/baseball-match-intel").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 = {
    "dayOffsets": ["0"],
    "matchStatuses": [],
    "leagues": [],
    "oddsMarkets": [],
}

# Run the Actor and wait for it to finish
run = client.actor("teamkamkod/baseball-match-intel").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 '{
  "dayOffsets": [
    "0"
  ],
  "matchStatuses": [],
  "leagues": [],
  "oddsMarkets": []
}' |
apify call teamkamkod/baseball-match-intel --silent --output-dataset

```

## MCP server setup

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

```

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/rAonVbYYhsA9Qi7Md/builds/Lx6OYSF2ntEO0knHl/openapi.json
