# Hong Kong Jockey Club (HKJC) Comprehensive Racing Data Scraper (`alaricus/hkjc-comprehensive-racing-data`) Actor

The definitive data solution for Hong Kong horse racing. Effortlessly extract comprehensive datasets including Race Results, Barrier Trials, Veterinary history, and Official Incident Reports. Engineered for high-speed performance and clean, developer-friendly JSON output.

- **URL**: https://apify.com/alaricus/hkjc-comprehensive-racing-data.md
- **Developed by:** [Alaricus](https://apify.com/alaricus) (community)
- **Categories:** Other, Developer tools, Automation
- **Stats:** 8 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Hong Kong Jockey Club (HKJC) Comprehensive Racing Data Scraper

[![HKJC Scraper Actor](https://apify.com/actor-badge?actor=alaricus/hkjc-comprehensive-racing-data)](https://apify.com/alaricus/hkjc-comprehensive-racing-data)

### What does the HKJC Comprehensive Racing Data Scraper do?
The **HKJC Comprehensive Racing Data Scraper** is an all-in-one intelligence tool designed to extract high-fidelity data from the official Hong Kong Jockey Club platform. It provides professional-grade access to the world’s most lucrative horse racing ecosystem, covering everything from historical race results to deep medical veterinary history.

This Actor is built for **professional handicappers, data scientists, and betting syndicate developers** who require structured, normalized JSON data to power their predictive models and racing dashboards in 2026.

### Key Features
* **Multi-Service Architecture:** Access four distinct data streams within a single Actor:
    * **Race Results:** Comprehensive finishing data, sectional times, and margins.
    * **Incident Reports:** Official steward reports and racing incidents for performance analysis.
    * **Barrier Trials:** Morning trial performance data and results.
    * **Veterinary Records:** Complete health history including lame records, surgeries, and "passed" dates.

* **One-Click Bulk Extraction:** Features "Scrape ALL available dates" toggles to automatically harvest years of historical data without manual date entry.
* **Targeted Veterinary Search:** Specific lookup mode for "Today's Declared Starters" or deep-history search by **Horse Brand Numbers** (e.g., K458).

### Why scrape HKJC data?
Hong Kong horse racing is a data-driven sport. This tool provides the "Home of Truth" data necessary for:
- **Algorithmic Betting:** Feed clean, historical datasets into ELO or machine learning models.
- **Horse Health Monitoring:** Track veterinary history and "passed" trials to identify horses returning from injury.
- **Jockey & Trainer Analysis:** Monitor weight allowances and performance trends across Sha Tin and Happy Valley.
- **Steward Insights:** Extract incident reports to find "unlucky" runners who faced interference but didn't place.

### How to use the Scraper
1. **Select Service Mode**: Choose between **Results, Reports, Trials,** or **Veterinary**.
2. **Configure Date Logic**:
    * **Bulk Mode:** Check the **"Scrape ALL available dates"** toggle to automatically discover and extract every date currently listed on the HKJC dropdowns (typically 150-200+ dates).
    * **Targeted Mode:** Provide a specific list of dates in `YYYY-MM-DD` format.
3. **Advanced Filters (Optional)**:
    * **Race Numbers:** Leave empty for all races, or specify (e.g., `1, 8, 10`) for targeted race analysis.
    * **Brand Numbers:** For Veterinary mode, enter specific IDs (e.g., `H095`) to get full lifetime medical history.
4. **Click Run**: The scraper handles the navigation, dropdown selection, and table extraction.
5. **Download Data**: Export your structured dataset in **JSON, CSV, or Excel**.

### Input Parameters
The parameters are organized into logical sections. Only the fields related to your selected **Mode** will be processed.

### 🛠 Input Configuration & Mode Mapping

The scraper is highly modular. Depending on the `mode` you select, different input parameters become active. Use the table below to configure your JSON input or UI settings.

| Service Mode (`mode`) | Parameter Key | Type | Description | Options / Format |
| :--- | :--- | :--- | :--- | :--- |
| **Race Results** (`result`) | `all_result_dates`<br>`result_dates`<br>`race_numbers` | `Boolean`<br>`Array`<br>`Array` | Toggle bulk extraction.<br>Target specific dates.<br>Target specific races. | `true` / `false`<br>`["YYYY-MM-DD"]`<br>`[1, 5]` (Empty = ALL) |
| **Incident Reports** (`report`) | `all_report_dates`<br>`report_dates` | `Boolean`<br>`Array` | Toggle bulk extraction.<br>Target dates for reports. | `true` / `false`<br>`["YYYY-MM-DD"]` |
| **Barrier Trials** (`barrier_trial`) | `all_barrier_dates`<br>`barrier_dates` | `Boolean`<br>`Array` | Toggle bulk extraction.<br>Target dates for trials. | `true` / `false`<br>`["YYYY-MM-DD"]` |
| **Veterinary Records** (`veterinary`) | `get_starters`<br>`get_full_database`<br>`brand_numbers` | `Boolean`<br>`Boolean`<br>`Array` | Scrape upcoming runners.<br>Enable history search.<br>Target Horse IDs. | `true` / `false`<br>`true` / `false`<br>`["K458", "H095"]` |
> **Pro Tip:** When using the API, ensure your `mode` matches the parameters you are sending. For example, if `mode` is set to `report`, the scraper will ignore `race_numbers`.

---

### Input and Output Examples

### 🏁RESULT MODE
#### Example Input
1. The "Historical Harvest" (Bulk Mode)
Best for users building a new database who want to scrape every race result currently listed on the HKJC website in one go.
```json
{
  "mode": "result",
  "all_result_dates": true
}
````

2. The "Targeted Handicapper" (Specific Races)
   Ideal for analyzing specific races on a given day (e.g., just the Feature Race or the first leg of a Triple Trio).

```json
{
  "mode": "result",
  "result_dates": ["2026-03-15"],
  "race_numbers": [1, 5]
}
```

3. The "Full Meeting" Scrape
   The standard way to get every result from a specific race day. By omitting `race_numbers`, the scraper automatically processes all races for that date.

```json
{
  "mode": "result",
  "result_dates": ["2026-03-15", "2026-03-18"]
}
```

#### Example Output

The output would be a list of dictionaries, such as the following:

```json
{
  "race_number": 2,
  "season_race": 516,
  "venue": "SHA TIN",
  "date": "2026-03-15",
  "race_title": "SOUTH WALL HANDICAP",
  "going": "GOOD TO FIRM",
  "track_type": "TURF",
  "track_type_status": "C+3 Course",
  "class": "Class 5",
  "distance": 1200,
  "max_rating": 40,
  "min_rating": 0,
  "prize": 875000,
  "race_time": [
    23.96,
    46.47,
    69.22
  ],
  "race_sectional_time": [
    {
      "main": 23.96,
      "subs": []
    },
    {
      "main": 22.51,
      "subs": [
        11.13,
        11.38
      ]
    },
    {
      "main": 22.75,
      "subs": [
        11.21,
        11.54
      ]
    }
  ],
  "place": 9,
  "status": "FINISHED",
  "horse_number": 11,
  "horse_name": "VERBIER",
  "horse_id": "J187",
  "horse_url": "https://racing.hkjc.com/en-us/local/information/horse?horseid=HK_2023_J187",
  "gear": [
    {
      "equipment": "BLINKERS",
      "action": "RETAINED"
    },
    {
      "equipment": "TONGUE_TIE",
      "action": "RETAINED"
    }
  ],
  "jockey_name": "L Ferraris",
  "jockey_id": "FEL",
  "jockey_url": "https://racing.hkjc.com/en-us/local/information/jockeyprofile?jockeyid=FEL&Season=Current",
  "trainer_name": "C Fownes",
  "trainer_id": "FC",
  "trainer_url": "https://racing.hkjc.com/en-us/local/information/trainerprofile?trainerid=FC&Season=Current",
  "actual_weight": 125,
  "declared_horse_weight": 1261,
  "draw": 8,
  "length_behind_winner_raw": "5-3/4",
  "length_behind_winner": 5.75,
  "running_position": [
    11,
    12,
    9
  ],
  "finish_time_raw": "1:10.14",
  "finish_time": 70.14,
  "win_odds": 15.0,
  "sectional_time": [
    {
      "position": 11,
      "margin_raw": "6-1/2",
      "margin": 6.5,
      "time": 25.0,
      "sub_splits": []
    },
    {
      "position": 12,
      "margin_raw": "5-3/4",
      "margin": 5.75,
      "time": 22.39,
      "sub_splits": [
        10.89,
        11.5
      ]
    },
    {
      "position": 9,
      "margin_raw": "5-3/4",
      "margin": 5.75,
      "time": 22.75,
      "sub_splits": [
        11.13,
        11.62
      ]
    }
  ],
  "comment": "Waited with towards rear, dropped to last place top of home straight, no impression."
}
```

***

### 📋REPORT MODE

#### Example Input

1. The "Historical Archive" (Bulk Reports)
   Automatically finds and extracts every Steward's Incident Report currently available in the HKJC dropdown archive. This is ideal for building a comprehensive database of racing interference and track incidents.

```json
{
  "mode": "report",
  "all_report_dates": true
}
```

2. Targeted Meeting Reports
   Scrapes official incident reports for a specific date (or set of dates). Use this to analyze the steward's findings immediately after a race meeting has concluded.

```json
{
  "mode": "report",
  "report_dates": ["2026-03-15", "2026-03-18"]
}
```

#### Example Output

The output would be a dictionary, such as the following:

```json
{
  "date": "2026-03-15",
  "start_time": "12:30",
  "venue": "SHA TIN",
  "track_type": "MIXED",
  "track_type_status": "AWT  / TURF C+3 COURSE",
  "going_details": [
    {
      "status": "GOOD",
      "races": [
        1,
        5,
        8
      ]
    },
    {
      "status": "GOOD TO FIRM",
      "races": [
        2,
        3,
        4,
        6,
        7,
        9,
        10,
        11
      ]
    }
  ],
  "penetrometer": [
    {
      "value": 2.71,
      "time": "08:00 am"
    },
    {
      "value": 2.71,
      "time": "11:30 am"
    }
  ],
  "clegg_hammer": [
    {
      "value": 9.06,
      "time": "08:00 am"
    },
    {
      "value": 9.08,
      "time": "11:30 am"
    }
  ],
  "stewards": [
    {
      "name": "Dr Henry H L Chan",
      "position": "Chairman"
    },
    {
      "name": "Mr Benedict Sin",
      "position": "Steward"
    },
    {
      "name": "Mr M Van Gestel",
      "position": "Chief Stipendiary Steward"
    },
    {
      "name": "Mr T Bailey",
      "position": "Stipendiary Steward"
    },
    {
      "name": "Mr T Vassallo",
      "position": "Stipendiary Steward"
    },
    {
      "name": "Mr K C Y Kwok",
      "position": "Stipendiary Steward"
    },
    {
      "name": "Mr J C H Ho",
      "position": "Stipendiary Steward"
    }
  ],
  "race_number": 2,
  "season_race": 516,
  "race_title": "SOUTH WALL HANDICAP",
  "section": 1,
  "race_class": "Class 5",
  "distance": 1200,
  "place": 11,
  "dead_heat": false,
  "horse_number": 1,
  "horse": {
    "name": "WINNING CIGAR",
    "id": "K422",
    "url": "https://racing.hkjc.com/en-us/local/information/horse?horseid=HK_2024_K422"
  },
  "drawn": 7,
  "jockey": {
    "name": "H Bentley",
    "id": "BHW",
    "url": "https://racing.hkjc.com/en-us/local/information/jockeyprofile?jockeyid=BHW&Season=Current",
    "allowance": 0
  },
  "incident": "Jumped only fairly.  Between the 300 Metres and the 200 Metres had difficulty obtaining clear running."
}
```

***

### 🏇 BARRIER TRIAL MODE

#### Example Input

1. Bulk Trial Discovery
   Fetches every available morning barrier trial result from the archive. Essential for tracking long-term horse preparation patterns and fitness cycles.

```json
{
  "mode": "barrier_trial",
  "all_barrier_dates": true
}
```

2. Recent Form Check
   Scrapes results for the most recent morning trials. This helps in identifying horses that showed strong speed or "finished strongly" in non-betting trials before their next race.

```json
{
  "mode": "barrier_trial",
  "barrier_dates": ["2026-04-02"]
}
```

#### Example Output

The output would be a dictionary, such as the following:

```json
{
  "batch_number": 2,
  "venue": "CONGHUA",
  "track_type": "ALL WEATHER TRACK",
  "distance": 1200,
  "going": "GOOD",
  "overall_time": 70.88,
  "sectional_times": [
    24.9,
    22.7,
    23.2
  ],
  "video_url": "https://racing.hkjc.com/contentAsset/videoplayer_v4/video-player-iframe_v4.html?type=brts&date=20260402&rc=ch&no=02&lang=eng&rf=http://racing.hkjc.com/en-us/local/information/btresult?Date=2026/04/02&pageid=racing/local&jumpTime=47",
  "date": "2026-04-02",
  "horse_name": "BEAUTY CRESCENT",
  "horse_id": "H334",
  "horse_url": "https://racing.hkjc.com/en-us/local/information/horse?horseid=HK_2022_H334",
  "jockey": "M Kellady",
  "trainer": "A S Cruz",
  "draw": 2,
  "gear": [
    {
      "equipment": "BLINKERS",
      "action": "RETAINED"
    }
  ],
  "lbw_raw": "8-1/4L",
  "lbw": 8.25,
  "running_position": [
    4,
    4,
    4
  ],
  "finish_time_raw": "1.12.21",
  "finish_time": 72.21,
  "result": "",
  "comment": "Limited response when asked; not as expected."
}
```

***

### 🏥VETERINARY MODE

#### Example Input

1. Targeted Horse Search (By Brand Number)
   The fastest way to get the full medical history for specific horses. Simply provide the unique HKJC Brand Numbers.

```json
{
  "mode": "veterinary",
  "brand_numbers": ["K458", "H095"]
}
```

2. Full Veterinary Database Export
   This is the "Power User" mode. It triggers the scraper to crawl the entire HKJC veterinary database to extract health records for every horse currently registered in the system. More than `700` horses with multiple reports.

```json
{
  "mode": "veterinary",
  "get_full_database": true
}
```

3. "Today's Starters" Health Check
   Automatically identifies all horses declared for the next upcoming race meeting and retrieves their medical history. Perfect for last-minute filtering of runners with recent health issues.

```json
{
  "mode": "veterinary",
  "get_starters": true
}
```

#### Example Output

The output would be a dictionary, such as the following:

```json
{
  "horse_name": "SETANTA",
  "horse_id": "G095",
  "vet_reports": [
    {
      "record_date": "2021-09-06",
      "record_details": "Castration.",
      "passing_date": null
    },
    {
      "record_date": "2025-08-11",
      "record_details": "Eight years of age or above at season end.",
      "passing_date": "2025-09-02"
    }
  ]
}
```

***

### 💰 Pricing: Pay-Per-Event (PPE)

This Actor uses a transparent **Pay-Per-Event** pricing model. You only pay for the individual records pushed to the dataset. For **Results**, **Reports**, and **Trials**, data is denormalized so that each horse's performance or incident is a unique, billable record.

- **Price per 1,000 results:** $15.00
- **Price per single record (1 Horse):** $0.015

#### 📊 Cost Examples:

| Service Mode | Estimated Records | Estimated Cost |
| :--- | :--- | :--- |
| **Full Race Meeting (Results)** | ~150 horse results | **~$2.25** |
| **Full Meeting Incident Reports** | ~140-150 reports | **~$2.10** |
| **Morning Barrier Trials** | ~50 - 100 horses | **$0.75 – $1.50** |
| **Lifetime Veterinary History** | 1 Horse (Full History) | **$0.015** |

> **Record Volume Warning:** The total number of records (and thus the cost) depends on the specific event. For example, a Barrier Trial morning may have only **50 horses**, while a peak season trial day could have over **100 horses**. Similarly, race cards vary between 8 and 11 races per meeting.

***

#### 💡 Pro Tip: Data Export

Because the data is **denormalized** (flattened), you can export these results directly to **Excel or CSV** from the Apify platform. Every row is a complete record containing both the horse's specific data and the meeting's metadata (Date, Venue, etc.), making it ready for immediate analysis in Pandas, Excel, or Google Sheets.

### 🛠 Troubleshooting

- **Date Formats:** Ensure dates are `YYYY-MM-DD`. If the UI shows a validation error, double-check your format.
- **Empty Results:** If you search for "Today's Starters" before the HKJC has officially declared the meeting (usually 48 hours before), the result list will be empty.
- **Race Numbers:** If you enter `[12]` for a meeting that only has 9 races, no data will be returned for that specific race number.

***

### ✉️ Feedback & Custom Work

I am committed to the ongoing development of this Actor. Future updates and feature additions (such as **Dividend/Payout scraping** or **Weather analysis**) will be prioritized based on user reviews, demand, and specific requests.

- **Support:** I actively monitor the performance of this tool to ensure it adapts to HKJC website updates. If you find any data inconsistencies or parsing errors, please open an issue in the Actor's **"Issues"** tab.
- **Reviews:** If this data powers your winning model or saves you hours of manual work, please leave a **5-star review**! Your feedback directly influences the development roadmap.
- **Customization:** Need a specialized data extractor, a custom database integration, or a unique "Actor-as-a-Product" solution? I am available for **custom Actor development**.

**Contact me:** <bd.pascari@gmail.com>

# Actor input Schema

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

Choose which section of the HKJC website you want to scrape data from.

## `results_section` (type: `string`):

Configure the parameters for scraping Race Results.

## `all_result_dates` (type: `boolean`):

Check this to automatically fetch every date currently available on the HKJC website.

## `result_dates` (type: `array`):

Only used if 'Scrape ALL' is unchecked. Enter dates in YYYY-MM-DD format.

## `race_numbers` (type: `array`):

Optional: Enter specific race numbers (e.g., 1, 2). Leave empty to scrape ALL races for the selected date.

## `report_section` (type: `string`):

Configure the parameters for scraping Incident Reports.

## `all_report_dates` (type: `boolean`):

Check this to fetch all historical incident reports available on the HKJC website.

## `report_dates` (type: `array`):

Specify exact dates for incident reports. Only used if 'Scrape ALL' is unchecked.

## `barrier_section` (type: `string`):

Configure the parameters for scraping Barrier Trials.

## `all_barrier_dates` (type: `boolean`):

Check this to fetch all historical barrier trial results available.

## `barrier_dates` (type: `array`):

Specify exact trial dates. Only used if 'Scrape ALL' is unchecked.

## `vet_section` (type: `string`):

Configure the parameters for scraping Veterinary Records.

## `get_starters` (type: `boolean`):

Fetch veterinary records for horses declared to start in upcoming races.

## `get_full_database` (type: `boolean`):

Search the comprehensive historical veterinary database. Often used with Brand Numbers.

## `brand_numbers` (type: `array`):

Specific horse brand numbers to look up (e.g., 'E123', 'G456'). Leave empty to fetch all.

## Actor input object example

```json
{
  "mode": "result",
  "all_result_dates": false,
  "result_dates": [
    "2024-04-10"
  ],
  "race_numbers": [
    1
  ],
  "all_report_dates": false,
  "report_dates": [
    "2024-04-10"
  ],
  "all_barrier_dates": false,
  "barrier_dates": [
    "2024-04-02"
  ],
  "get_starters": false,
  "get_full_database": false,
  "brand_numbers": [
    "G095"
  ]
}
```

# 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 = {
    "result_dates": [
        "2024-04-10"
    ],
    "race_numbers": [
        1
    ],
    "report_dates": [
        "2024-04-10"
    ],
    "barrier_dates": [
        "2024-04-02"
    ],
    "brand_numbers": [
        "G095"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("alaricus/hkjc-comprehensive-racing-data").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 = {
    "result_dates": ["2024-04-10"],
    "race_numbers": [1],
    "report_dates": ["2024-04-10"],
    "barrier_dates": ["2024-04-02"],
    "brand_numbers": ["G095"],
}

# Run the Actor and wait for it to finish
run = client.actor("alaricus/hkjc-comprehensive-racing-data").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 '{
  "result_dates": [
    "2024-04-10"
  ],
  "race_numbers": [
    1
  ],
  "report_dates": [
    "2024-04-10"
  ],
  "barrier_dates": [
    "2024-04-02"
  ],
  "brand_numbers": [
    "G095"
  ]
}' |
apify call alaricus/hkjc-comprehensive-racing-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=alaricus/hkjc-comprehensive-racing-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Hong Kong Jockey Club (HKJC) Comprehensive Racing Data Scraper",
        "description": "The definitive data solution for Hong Kong horse racing. Effortlessly extract comprehensive datasets including Race Results, Barrier Trials, Veterinary history, and Official Incident Reports. Engineered for high-speed performance and clean, developer-friendly JSON output.",
        "version": "0.1",
        "x-build-id": "6zIq5AXupMU55cb9m"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/alaricus~hkjc-comprehensive-racing-data/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-alaricus-hkjc-comprehensive-racing-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/alaricus~hkjc-comprehensive-racing-data/runs": {
            "post": {
                "operationId": "runs-sync-alaricus-hkjc-comprehensive-racing-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/alaricus~hkjc-comprehensive-racing-data/run-sync": {
            "post": {
                "operationId": "run-sync-alaricus-hkjc-comprehensive-racing-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Select Scrape Mode",
                        "enum": [
                            "result",
                            "report",
                            "barrier_trial",
                            "veterinary"
                        ],
                        "type": "string",
                        "description": "Choose which section of the HKJC website you want to scrape data from.",
                        "default": "result"
                    },
                    "results_section": {
                        "title": "Results Configuration",
                        "type": "string",
                        "description": "Configure the parameters for scraping Race Results."
                    },
                    "all_result_dates": {
                        "title": "Scrape ALL available Result dates",
                        "type": "boolean",
                        "description": "Check this to automatically fetch every date currently available on the HKJC website.",
                        "default": false
                    },
                    "result_dates": {
                        "title": "Specific Result Dates (YYYY-MM-DD)",
                        "type": "array",
                        "description": "Only used if 'Scrape ALL' is unchecked. Enter dates in YYYY-MM-DD format.",
                        "items": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
                        }
                    },
                    "race_numbers": {
                        "title": "Race Numbers",
                        "type": "array",
                        "description": "Optional: Enter specific race numbers (e.g., 1, 2). Leave empty to scrape ALL races for the selected date.",
                        "items": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 15
                        }
                    },
                    "report_section": {
                        "title": "Report Configuration",
                        "type": "string",
                        "description": "Configure the parameters for scraping Incident Reports."
                    },
                    "all_report_dates": {
                        "title": "Scrape ALL available Report dates",
                        "type": "boolean",
                        "description": "Check this to fetch all historical incident reports available on the HKJC website.",
                        "default": false
                    },
                    "report_dates": {
                        "title": "Specific Report Dates (YYYY-MM-DD)",
                        "type": "array",
                        "description": "Specify exact dates for incident reports. Only used if 'Scrape ALL' is unchecked.",
                        "items": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
                        }
                    },
                    "barrier_section": {
                        "title": "Barrier Trial Configuration",
                        "type": "string",
                        "description": "Configure the parameters for scraping Barrier Trials."
                    },
                    "all_barrier_dates": {
                        "title": "Scrape ALL available Trial dates",
                        "type": "boolean",
                        "description": "Check this to fetch all historical barrier trial results available.",
                        "default": false
                    },
                    "barrier_dates": {
                        "title": "Specific Barrier Dates (YYYY-MM-DD)",
                        "type": "array",
                        "description": "Specify exact trial dates. Only used if 'Scrape ALL' is unchecked.",
                        "items": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
                        }
                    },
                    "vet_section": {
                        "title": "Veterinary Settings",
                        "type": "string",
                        "description": "Configure the parameters for scraping Veterinary Records."
                    },
                    "get_starters": {
                        "title": "Scrape Today's Starters",
                        "type": "boolean",
                        "description": "Fetch veterinary records for horses declared to start in upcoming races.",
                        "default": false
                    },
                    "get_full_database": {
                        "title": "Search Historical Database",
                        "type": "boolean",
                        "description": "Search the comprehensive historical veterinary database. Often used with Brand Numbers.",
                        "default": false
                    },
                    "brand_numbers": {
                        "title": "Target Brand Numbers",
                        "type": "array",
                        "description": "Specific horse brand numbers to look up (e.g., 'E123', 'G456'). Leave empty to fetch all.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
