{
  "openapi": "3.0.1",
  "info": {
    "title": "Trainline Scraper",
    "description": "Scrape Trainline - the UK & Europe rail/bus metasearch. Journey search (origin → destination → date/time) with departure/arrival times, duration, changes, operator and fares; station autocomplete lookup; and popular routes with 'from' prices.",
    "version": "1.0",
    "x-build-id": "qWuOjfhbwnuryY0Vz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~trainline-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-trainline-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/crawlerbros~trainline-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-trainline-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/crawlerbros~trainline-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-trainline-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "stationLookup",
              "popularRoutes"
            ],
            "type": "string",
            "description": "What to fetch.",
            "default": "search"
          },
          "originStation": {
            "title": "Origin station",
            "type": "string",
            "description": "Departure station or city, e.g. `London Euston`, `Paris`, `Manchester Piccadilly` (mode=search).",
            "default": "London Euston"
          },
          "destinationStation": {
            "title": "Destination station",
            "type": "string",
            "description": "Arrival station or city (mode=search).",
            "default": "Birmingham New Street"
          },
          "stationQuery": {
            "title": "Station query (mode=stationLookup)",
            "type": "string",
            "description": "Free-text station name, e.g. `London`, `Birmingham` — returns matching stations with codes, coordinates and connections."
          },
          "travelDate": {
            "title": "Travel date",
            "type": "string",
            "description": "Journey date in `YYYY-MM-DD` (mode=search). Defaults to today + 7 days when empty or in the past.",
            "default": ""
          },
          "departAfter": {
            "title": "Depart after",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
            "type": "string",
            "description": "Only emit journeys departing at or after this time, `HH:MM` (mode=search)."
          },
          "arriveBy": {
            "title": "Arrive by",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
            "type": "string",
            "description": "Only emit journeys arriving at or before this time, `HH:MM` (mode=search)."
          },
          "ticketType": {
            "title": "Ticket type",
            "enum": [
              "Standard",
              "First",
              "Season"
            ],
            "type": "string",
            "description": "Fare class to keep: `Standard`, `First` or `Season` (mode=search). Journeys without a detectable class pass through."
          },
          "maxPrice": {
            "title": "Max price",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Drop records with a price above this amount (mode=search)."
          },
          "locale": {
            "title": "Locale",
            "enum": [
              "en-gb",
              "en-us",
              "en-fr",
              "fr-fr",
              "de-de",
              "it-it",
              "es-es",
              "nl-nl",
              "pt-pt",
              "pl-pl",
              "da-dk",
              "sv-se",
              "no-no",
              "fi-fi",
              "cs-cz",
              "hu-hu",
              "ro-ro",
              "el-gr"
            ],
            "type": "string",
            "description": "Site locale used for station search and route pages.",
            "default": "en-gb"
          },
          "currency": {
            "title": "Currency (ISO 4217)",
            "enum": [
              "GBP",
              "EUR",
              "USD",
              "CHF",
              "PLN",
              "CZK",
              "DKK",
              "SEK",
              "NOK",
              "HUF",
              "RON",
              "BGN",
              "HRK",
              "TRY",
              "ISK",
              "RSD",
              "UAH",
              "MKD",
              "ALL",
              "BAM",
              "MDL",
              "LTL",
              "LVL",
              "EEK"
            ],
            "type": "string",
            "description": "Currency code passed to the results page, e.g. `GBP`, `EUR`.",
            "default": "GBP"
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Hard cap on emitted records.",
            "default": 50
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional Apify proxy. Engaged automatically only when the source blocks direct requests (403/429)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}