# Flashscore Multi-Sport: Scores, Fixtures & Season History (`mo_khairy/flashscore-multi`) Actor

Live scores, fixtures, results and full-season historical backfill from Flashscore across football, basketball, tennis, hockey, baseball and more — one stable schema, ML-ready flat rows, incremental monitoring mode, and optional stats, lineups and odds add-ons.

- **URL**: https://apify.com/mo_khairy/flashscore-multi.md
- **Developed by:** [Mohamed Khairy](https://apify.com/mo_khairy) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.50 / 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.

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 Multi-Sport Scraper — live scores, ML-ready history & change events

One Apify actor for **Flashscore**: today's fixtures across 5 sports, **whole-season
historical backfill** for ML training sets, and **change-event monitoring** for
webhooks — all in one stable, versioned schema.

> **[Build plan](./PLAN.md)** · **[Verified feed map](./docs/api-notes.md)** ·
> Status: Phases 0–4 complete (49/49 tests green), Phase 5 (launch) in progress.

### Why this actor

| | This actor | Typical "flashscore scraper" |
|---|---|---|
| Sports | football, tennis, basketball, ice-hockey, handball | football only |
| Modes | day list · **season backfill** · **incremental events** | day list |
| History | any league season back to 1901 in one run | page-scraped, fragile |
| Output | flat JSON rows, stable IDs, `schemaVersion`-pinned | HTML fragments |
| Monitoring | 304-based change events (`goal`, `match_finished`, `odds_moved`) | none |
| Pricing | pay-per-event — you pay per match, not per compute-hour | platform compute |
| When it breaks | **fails loudly** with a per-source summary — never fake success | silent empty runs |

### The three modes

**Day mode** — fixtures/results for today ±7 days, one request per sport per day.

```json
{ "mode": "day", "sports": ["football", "basketball"], "dayOffsets": [0], "status": "all" }
```

**Season mode** — historical backfill. League URL in, whole seasons out
(EPL 2019–2025 = 2,325 matches in one run, 24 requests):

```json
{ "mode": "season", "leagueUrls": ["football/england/premier-league"], "seasons": ["2019-2020", "2020/2021"] }
```

**Incremental mode** — scheduled every 5–15 min. Emits change events to webhooks;
costs near-zero when nothing changed (conditional `If-None-Match` polling → HTTP 304):

```json
{ "mode": "incremental", "sports": ["football"], "dayOffsets": [0], "includeOdds": true }
```

Event types: `match_new`, `match_finished`, `score_changed` (goal),
`status_changed`, `start_time_changed`, `match_removed`, `odds_moved` — each row
carries `matchId`, before/after payloads, and the match URL.

### Detail add-ons (per match, pay-per-event)

Checkbox inputs on day/incremental runs: `includeStats` (possession, shots, xG),
`includeIncidents` (goals/cards/subs with players & minutes), `includeLineups`
(formation, starters, subs, coach), `includeOdds` (bookmaker comparison).
`maxDetailsPerRun` caps enrichment; budget is checked before every paid call.

### Output (schema v1, per match — flat & ML-ready)

```jsonc
{
  "schemaVersion": 1,
  "matchId": "byLb0nn",            // stable ID, usable as primary key
  "sport": "football",
  "country": "England",
  "league": "Premier League",
  "leagueId": "dYlOSQOD",
  "season": "2024/2025",           // season mode
  "round": "Round 38",             // season mode
  "startTime": "2026-09-20T13:00:00Z",
  "status": "finished",            // scheduled | live | finished | unknown
  "home": { "id": "Wtn9Stg0", "name": "Manchester City" },
  "away": { "id": "WSzc94ws", "name": "Sunderland" },
  "score": { "home": 5, "away": 3 },
  "periodScores": [{ "label": "1st Half", "home": 3, "away": 2 }],
  "matchUrl": "https://www.flashscore.com/match/byLb0nn/",
  "fetchedAt": "2026-11-11T12:00:00Z"
}
```

Every run ends with a `run-summary` row: per-source HTTP status, match counts,
event tally, and `ok`. **Fail-loudly policy**: if every source errors, the run
exits 1 and says so — a broken feed never looks like an empty day.

### Pricing (pay-per-event)

| Event | Price | When |
|---|---|---|
| `match-listed` | ~$0.0005 / match | every match row emitted |
| `match-details` | ~$0.002 / match | stats/incidents/lineups fetched |
| `odds-fetched` | ~$0.002 / match | odds fetched (incl. incremental odds checks) |
| `historical-season` | ~$0.01 / season | each league-season backfilled |

A 1,000-match day run ≈ $0.50. A daily monitoring run with no changes ≈ free
(304) plus platform start. Prices are estimates pending final Console config.

### Recipes

**n8n / Make webhook** — schedule incremental every 5 min, webhook on run
completion, filter dataset items `kind == "event"`, route `eventType ==
"score_changed"` to your alert channel.

**Google Sheets daily export** — schedule day mode 2×/day, Apify→Sheets
integration keyed on `matchId`.

**ML training set** — season mode for 5–10 seasons, concatenate datasets, group
by `matchId`; deterministic row order makes reruns diff-clean.

# Actor input Schema

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

day: today ±7 days (default). season: backfill whole seasons or team histories. incremental: only new or changed matches since the last run (for 5–15 min schedules).

## `sports` (type: `array`):

Sports to list in day mode (season mode takes the sport from each league page). Football, tennis and basketball have the deepest feed coverage.

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

Days relative to today (day mode): 0 = today, -1 = yesterday, 1 = tomorrow. Valid range -7 to +7.

## `leagueUrls` (type: `array`):

League pages to backfill, e.g. football/england/premier-league or a full URL. Season mode only.

## `seasons` (type: `array`):

Season names to backfill, e.g. 2019-2020 or 2020/2021 (or a numeric feed season id). Empty = current season only.

## `status` (type: `string`):

Filter matches by status.

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

Fetch per-match statistics (possession, shots, xG). Charged per match (add-on event).

## `includeIncidents` (type: `boolean`):

Fetch per-match incidents (goals, cards, substitutions with players and minutes) and period scores. Charged per match (add-on event).

## `includeLineups` (type: `boolean`):

Fetch confirmed lineups with formations, starters, substitutes and coaches (covered matches only). Charged per match (add-on event).

## `includeOdds` (type: `boolean`):

Fetch bookmaker odds for each match (pre-match comparison across markets). Charged per match (add-on event).

## `maxDetailsPerRun` (type: `integer`):

Cap on how many matches get statistics/incidents/lineups/odds per run (detail requests are one-per-match). 0 = all matches.

## `leagueFilter` (type: `array`):

Case-insensitive substrings matched against the league name, e.g. "Premier League".

## `countryFilter` (type: `array`):

Case-insensitive substrings matched against the country, e.g. "England".

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

Stop after this many match rows. A busy football weekend lists 1,000–1,500 matches.

## Actor input object example

```json
{
  "mode": "day",
  "sports": [
    "football"
  ],
  "dayOffsets": [
    0
  ],
  "leagueUrls": [
    "football/england/premier-league"
  ],
  "seasons": [
    "2019-2020"
  ],
  "status": "all",
  "includeStats": false,
  "includeIncidents": false,
  "includeLineups": false,
  "includeOdds": false,
  "maxDetailsPerRun": 0,
  "leagueFilter": [],
  "countryFilter": [],
  "maxResults": 1000
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing match rows (day/season), change events (incremental) and one run-summary row

# 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 = {
    "sports": [
        "football"
    ],
    "dayOffsets": [
        0
    ],
    "leagueUrls": [
        "football/england/premier-league"
    ],
    "seasons": [
        "2019-2020"
    ],
    "maxDetailsPerRun": 0,
    "leagueFilter": [],
    "countryFilter": [],
    "maxResults": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("mo_khairy/flashscore-multi").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 = {
    "sports": ["football"],
    "dayOffsets": [0],
    "leagueUrls": ["football/england/premier-league"],
    "seasons": ["2019-2020"],
    "maxDetailsPerRun": 0,
    "leagueFilter": [],
    "countryFilter": [],
    "maxResults": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("mo_khairy/flashscore-multi").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 '{
  "sports": [
    "football"
  ],
  "dayOffsets": [
    0
  ],
  "leagueUrls": [
    "football/england/premier-league"
  ],
  "seasons": [
    "2019-2020"
  ],
  "maxDetailsPerRun": 0,
  "leagueFilter": [],
  "countryFilter": [],
  "maxResults": 1000
}' |
apify call mo_khairy/flashscore-multi --silent --output-dataset

```

## MCP server setup

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

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/gxdrsIcB20jJRGF2M/builds/IhJSym00xrzzbNxid/openapi.json
