{
  "openapi": "3.0.1",
  "info": {
    "title": "Hong Kong Transit Scraper - MTR, KMB, Citybus, Light Rail",
    "description": "Hong Kong public transit data via the official HKSAR open APIs: MTR (10 lines), KMB and Citybus bus networks, and MTR Light Rail. Bilingual English / Traditional Chinese station names, real-time train and bus ETAs, full route catalogues.",
    "version": "1.0",
    "x-build-id": "8RSnVSfRoNsLCXPNK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jungle_synthesizer~hong-kong-transit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jungle_synthesizer-hong-kong-transit-scraper",
        "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/jungle_synthesizer~hong-kong-transit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-jungle_synthesizer-hong-kong-transit-scraper",
        "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/jungle_synthesizer~hong-kong-transit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-jungle_synthesizer-hong-kong-transit-scraper",
        "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",
        "properties": {
          "sp_intended_usage": {
            "title": "What is the intended usage of this data?",
            "minLength": 1,
            "type": "string",
            "description": "Please describe how you plan to use the data extracted by this crawler."
          },
          "sp_improvement_suggestions": {
            "title": "How can we improve this crawler for you?",
            "minLength": 1,
            "type": "string",
            "description": "Provide any feedback or suggestions for improvements."
          },
          "sp_contact": {
            "title": "Contact Email",
            "minLength": 1,
            "type": "string",
            "description": "Provide your email address so we can get in touch with you."
          },
          "mode": {
            "title": "Scrape Mode",
            "enum": [
              "route_list",
              "station_list",
              "route_stops",
              "stop_eta"
            ],
            "type": "string",
            "description": "What to extract. route_list returns every route the operator runs. station_list returns the operator's full station / stop inventory with bilingual names and coordinates. route_stops returns the ordered stop sequence for a single route. stop_eta returns real-time arrival ETAs at a single stop.",
            "default": "route_list"
          },
          "operator": {
            "title": "Operator",
            "enum": [
              "mtr",
              "mtr_lr",
              "kmb",
              "citybus"
            ],
            "type": "string",
            "description": "Which Hong Kong transit operator to query. MTR covers all heavy-rail lines (Island, Tsuen Wan, Kwun Tong, Tseung Kwan O, Tung Chung, Airport Express, East Rail, Tuen Ma, South Island, Disneyland Resort). MTR Light Rail covers Tuen Mun / Yuen Long routes 505-761P.",
            "default": "mtr"
          },
          "route": {
            "title": "Route Number",
            "type": "string",
            "description": "Required for route_stops. Optional for stop_eta (filters ETAs to one route). For KMB/Citybus this is the bus route number ('1A', '118'). For MTR this is the line code (TKL, ISL, EAL, TWL, KTL, TCL, AEL, TML, SIL, DRL). Ignored in route_list and station_list."
          },
          "direction": {
            "title": "Direction",
            "enum": [
              "outbound",
              "inbound",
              "UP",
              "DOWN"
            ],
            "type": "string",
            "description": "Required for route_stops. 'outbound' / 'inbound' for KMB/Citybus, 'UP' / 'DOWN' for MTR. Defaults to 'outbound'.",
            "default": "outbound"
          },
          "stop_id": {
            "title": "Stop / Station ID",
            "type": "string",
            "description": "Required for stop_eta. Operator-specific stop identifier. KMB stop IDs are 16-character hex (e.g. 'A3ADFCDF8487ADB9'). Citybus stop IDs are 6-digit numbers ('001027'). MTR uses 3-letter station codes ('CEN', 'TST'). Light Rail uses 3-letter stop codes ('TML', 'TIK'). Run station_list mode first to discover IDs."
          },
          "mtr_line": {
            "title": "MTR Line (for stop_eta on MTR only)",
            "type": "string",
            "description": "Only used when operator='mtr' and mode='stop_eta'. The MTR Next Train API requires both station code and line code. Examples: TKL, ISL, EAL, TWL, KTL, TCL, AEL, TML, SIL, DRL."
          },
          "maxItems": {
            "title": "Max Items",
            "type": "integer",
            "description": "Maximum records to return. The Apify automated tester runs the default — keep small (15) for fast validation. Set higher (e.g. 1000+) for full inventory dumps.",
            "default": 15
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy not required — HKSAR open data APIs are public and keyless. Default: no proxy."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}