# Flashscore Tennis Stats API (`structlabs/flashscore-tennis-stats-api`) Actor

Tennis match results with per-set games, durations, winners and the full match statistics table from Flashscore's public feed. Day windows, tour and status filters. No browser, no proxy.

- **URL**: https://apify.com/structlabs/flashscore-tennis-stats-api.md
- **Developed by:** [Mohit Tripathi](https://apify.com/structlabs) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.04 / 1,000 match scrapeds

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 Tennis Stats API

Tennis match results with **per-set games, durations, winners and the full match statistics table** from Flashscore's public tennis feed. One row per match, with day-window, tour, status and tournament filters.

- **Direct HTTP feed** — no browser, cookies, login or proxy.
- **Stats included** — aces, double faults, serve/return/points/games, for the match and each set.
- **Pay per event:** `match-scraped` **$2.40 / 1,000** matches + `apify-actor-start` $0.05 / 1,000 starts.
- **Measured payload:** 803 B/match average, 3.26 KB/match worst day; 6.0 KB/match with stats = 6.0 MB / 1,000.

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `dayOffsets` | array of strings | `["-1"]` | `-7` to `+2`; `-1` = yesterday (default), `0` = today. |
| `tours` | array | `["atp","wta"]` | `atp`, `wta`, `itf`, `challenger`. Empty = all tours. |
| `matchStatuses` | array | `["finished"]` | `finished`, `live`, `scheduled`, `all`. |
| `tournaments` | array | `[]` | Case-insensitive partial match on the tournament name. |
| `includeStats` | boolean | `true` | Fetch `df_st_2` for finished matches. |
| `includeSetDurations` | boolean | `true` | Fetch `df_sui_2` for set games and durations. |
| `maxItems` | integer | `15` | Hard stop across days and tours. One billed event per row. |
| `requestDelayMs` | integer | `100` | Pause between per-match calls. |
| `maxRetries` | integer | `3` | Retries on 429/5xx with 1 s / 3 s / 9 s backoff. |

The prefill (`day -1`, ATP/WTA, finished, max 15) runs in about 5 s including Actor startup and is non-empty at any hour because yesterday has a complete finished slate. A 100-match run on a full historical day completes in about 20 s.

### Output

| Field | Type | Notes |
|---|---|---|
| `match_id` | string | Flashscore match ID. |
| `match_url` | string or null | Public match URL. |
| `start_time_utc` | string or null | ISO-8601 UTC start time. |
| `status` | string | `scheduled`, `live`, `finished` or `unknown`. |
| `tour` | string | `atp`, `wta`, `itf`, `challenger` or `other`. |
| `tournament_name` | string | Tournament display name. |
| `tournament_url` | string or null | Public tournament URL. |
| `surface` | string or null | `hard`, `clay`, `grass`, `carpet`, optionally `(indoor)`. |
| `match_type` | string | `singles` or `doubles`. |
| `round` | string or null | Best-effort; null when the day feed does not expose it. |
| `note` | string or null | `Retired`, `Walkover` and similar match notes. |
| `home_player` | object | Name, player ID, slug, nationality, ranking, photo URL. |
| `away_player` | object | Same shape as home. |
| `sets_won_home` | integer | Sets won by the home player. |
| `sets_won_away` | integer | Sets won by the away player. |
| `sets` | array | Per-set games, duration and winner. |
| `winner` | string or null | `home`, `away` or null. |
| `result_type` | string or null | `normal`, `retirement`, `walkover`, `defaulted` or null. |
| `total_duration` | string or null | Total match duration from the set feed. |
| `has_odds` | boolean | True when the day feed carries bookmaker odds. |
| `stats` | object or null | Match and per-set statistics; null when no stats are published. |
| `scraped_at` | string | ISO timestamp of this run. |

A scheduled match is still a valid row: `sets` is empty and `stats` is `null`, and it is billed once.

```json
{
  "match_id": "ED4yCVJO",
  "match_url": "https://www.flashscore.com/match/ED4yCVJO/",
  "start_time_utc": "2026-11-22T20:45:00+00:00",
  "status": "finished",
  "tour": "wta",
  "tournament_name": "WTA - SINGLES: Billie Jean King Cup - World Group (World) - Relegation - Play Offs",
  "tournament_url": "https://www.flashscore.com/tennis/wta-singles/billie-jean-king-cup-world-group/",
  "surface": null,
  "match_type": "singles",
  "round": null,
  "note": null,
  "home_player": {
    "name": "Krueger A.",
    "player_id": "jP0X7eBG",
    "slug": "krueger-ashlyn",
    "nationality": "USA",
    "ranking": 200,
    "photo_url": "https://static.flashscore.com/res/image/data/tQDMPh8k-f7v3Inzp.png"
  },
  "away_player": {
    "name": "Nagy A.",
    "player_id": "Oxau6ZuT",
    "slug": "nagy-adrienn",
    "nationality": "Hungary",
    "ranking": 91,
    "photo_url": "https://static.flashscore.com/res/image/data/hn6j94Qq-zyqr0PYl.png"
  },
  "sets_won_home": 2,
  "sets_won_away": 0,
  "sets": [
    {"set": 1, "home_games": 6, "away_games": 2, "duration": "0:30", "winner": "home"},
    {"set": 2, "home_games": 6, "away_games": 1, "duration": "0:29", "winner": "home"}
  ],
  "winner": "home",
  "result_type": "normal",
  "total_duration": "0:59",
  "has_odds": false,
  "stats": {
    "match": {
      "service": {
        "aces": {"home": "7", "away": "3", "home_num": 7, "away_num": 3},
        "double_faults": {"home": "0", "away": "7", "home_num": 0, "away_num": 7},
        "break_points_saved": {"home": "3/4", "away": "4/9", "home_num": 3, "away_num": 4}
      },
      "return": {
        "break_points_converted": {"home": "5/9", "away": "1/4", "home_num": 5, "away_num": 1}
      },
      "points": {
        "total_points_won": {"home": "61% (64/105)", "away": "39% (41/105)", "home_num": 61, "away_num": 39}
      },
      "games": {
        "total_games_won": {"home": "80% (12/15)", "away": "20% (3/15)", "home_num": 80, "away_num": 20}
      }
    },
    "sets": [
      {"set": 1, "service": {"aces": {"home": "3", "away": "3", "home_num": 3, "away_num": 3}}},
      {"set": 2, "service": {"aces": {"home": "4", "away": "0", "home_num": 4, "away_num": 0}}}
    ]
  },
  "scraped_at": "2026-11-23T10:57:31.957276+00:00"
}
```

The full row, including every stats group and both set sections, is in [`examples/sample_output.json`](examples/sample_output.json). Raw statistic values are preserved as strings and also parsed to `home_num` / `away_num` when the value starts with a number.

### Pricing

| Event | Price | Charged when |
|---|---:|---|
| `apify-actor-start` | $0.05 / 1,000 runs | Synthetic start, automatic |
| `match-scraped` | **$2.40 / 1,000 matches** | Per unique match row written to the dataset |
| `match-scraped` Gold tier | $2.04 / 1,000 matches | 15% Store discount |

No charge for empty day feeds, retries, duplicate match IDs or rows without a match ID and two players. Net margin is about 79.8% at list price and 79.8% at the Gold tier after Apify's 20% share, bandwidth and compute.

### MCP / AI-agent use

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--actors",
        "structlabs/flashscore-tennis-stats-api"
      ],
      "env": {
        "APIFY_TOKEN": "<your token>"
      }
    }
  }
}
```

Or use the hosted endpoint: `https://mcp.apify.com/?actors=structlabs/flashscore-tennis-stats-api`.

- n8n workflow, MCP config and quickstarts: https://github.com/structlabs-hq/flashscore-tennis-stats-api-n8n-mcp

### Local test

```bash
apify run -i '{"dayOffsets":["-1"],"tours":["atp","wta"],"matchStatuses":["finished"],"maxItems":15}'
ACTOR_TEST_PAY_PER_EVENT=true apify run -i '{"dayOffsets":["-1"],"tours":[],"matchStatuses":["all"],"maxItems":10}'
```

### Feed token note

The feed requires the public client header `x-fsign: SW9D1eZo`. It is not a user login or API key. If Flashscore rotates it, re-extract the current value from the public `flashscore.com` site bundle and update `HEADERS` in `my_actor/main.py`.

### Limits and honest notes

- `round` is null unless the day feed exposes a human-readable round label; it is never guessed.
- Scheduled matches have no set or stats body; `sets` is empty and `stats` is null.
- For doubles, the two-player side may be represented as one combined name when the feed publishes it that way.
- `has_odds` only flags that odds exist; the v1 row does not expand the bookmaker table.
- Respect Flashscore's terms and applicable sports-data rules.

# Actor input Schema

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

Day offsets from today, -7 to +2. 0 = today; -1 = yesterday (default, a full finished slate).

## `tours` (type: `array`):

atp, wta, itf, challenger. Empty = all tours.

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

finished, live, scheduled or all.

## `tournaments` (type: `array`):

Case-insensitive partial match on the tournament name. Empty = all tournaments.

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

Fetch the full match stats table for finished matches. Scheduled matches have no stats.

## `includeSetDurations` (type: `boolean`):

Fetch per-set games and durations for finished matches.

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

Hard stop across all days and tours. Each pushed match is one match-scraped event.

## `requestDelayMs` (type: `integer`):

Pause between per-match set and stats requests.

## `maxRetries` (type: `integer`):

Retries on 429/5xx with 1 s / 3 s / 9 s backoff.

## Actor input object example

```json
{
  "dayOffsets": [
    "-1"
  ],
  "tours": [
    "atp",
    "wta"
  ],
  "matchStatuses": [
    "finished"
  ],
  "includeStats": true,
  "includeSetDurations": true,
  "maxItems": 15,
  "requestDelayMs": 100,
  "maxRetries": 3
}
```

# Actor output Schema

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

No description

## `table` (type: `string`):

No description

## `sets` (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 = {
    "dayOffsets": [
        "-1"
    ],
    "tours": [
        "atp",
        "wta"
    ],
    "matchStatuses": [
        "finished"
    ],
    "includeStats": true,
    "includeSetDurations": true,
    "maxItems": 15,
    "requestDelayMs": 100,
    "maxRetries": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("structlabs/flashscore-tennis-stats-api").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": ["-1"],
    "tours": [
        "atp",
        "wta",
    ],
    "matchStatuses": ["finished"],
    "includeStats": True,
    "includeSetDurations": True,
    "maxItems": 15,
    "requestDelayMs": 100,
    "maxRetries": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("structlabs/flashscore-tennis-stats-api").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": [
    "-1"
  ],
  "tours": [
    "atp",
    "wta"
  ],
  "matchStatuses": [
    "finished"
  ],
  "includeStats": true,
  "includeSetDurations": true,
  "maxItems": 15,
  "requestDelayMs": 100,
  "maxRetries": 3
}' |
apify call structlabs/flashscore-tennis-stats-api --silent --output-dataset

```

## MCP server setup

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

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/4YuaZubiWtys6llgh/builds/C9kdWg6UYDWAsyMAa/openapi.json
