{
  "openapi": "3.0.1",
  "info": {
    "title": "National Rail Train Ticket & Connection Scraper",
    "description": "Scrape live train connections, schedules, ticket prices, transfers, delays, and fares across the UK. Extract structured UK timetable data for travel apps, price monitoring, analytics, and AI agents.",
    "version": "0.0",
    "x-build-id": "gxugBOUPmWPAUYKqk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jindrich.bar~national-rail-ticket-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jindrich.bar-national-rail-ticket-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/jindrich.bar~national-rail-ticket-scraper/runs": {
      "post": {
        "operationId": "runs-sync-jindrich.bar-national-rail-ticket-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/jindrich.bar~national-rail-ticket-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-jindrich.bar-national-rail-ticket-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": [
          "from",
          "to"
        ],
        "properties": {
          "from": {
            "title": "From station",
            "type": "string",
            "description": "Origin station name or CRS code (e.g. \"London Kings Cross\", \"KGX\"). Group names such as \"London\" or \"Birmingham\" are also accepted.",
            "default": "London Kings Cross"
          },
          "to": {
            "title": "To station",
            "type": "string",
            "description": "Destination station name or CRS code (e.g. \"Edinburgh\", \"EDB\").",
            "default": "Edinburgh"
          },
          "date": {
            "title": "Travel date",
            "type": "string",
            "description": "Travel date (YYYY-MM-DD), UK local time. Leave empty to use today."
          },
          "time": {
            "title": "Travel time",
            "pattern": "^\\d{1,2}:\\d{2}$",
            "type": "string",
            "description": "Time in HH:MM (24h) format, UK local time. Leave empty to use the current time."
          },
          "timeType": {
            "title": "Time type",
            "enum": [
              "DEPART",
              "ARRIVE"
            ],
            "type": "string",
            "description": "Whether the travel time is a departure time or a required arrival time.",
            "default": "DEPART"
          },
          "adults": {
            "title": "Adults",
            "minimum": 0,
            "maximum": 9,
            "type": "integer",
            "description": "Number of adult passengers (16+) used for fare pricing.",
            "default": 1
          },
          "children": {
            "title": "Children",
            "minimum": 0,
            "maximum": 9,
            "type": "integer",
            "description": "Number of child passengers (5–15) used for fare pricing.",
            "default": 0
          },
          "fareClass": {
            "title": "Fare class",
            "enum": [
              "ANY",
              "STANDARD",
              "FIRST"
            ],
            "type": "string",
            "description": "Which ticket classes to price. ANY returns both standard and first class fares.",
            "default": "ANY"
          },
          "directTrains": {
            "title": "Direct trains only",
            "type": "boolean",
            "description": "If enabled, only journeys without a change of train are returned.",
            "default": false
          },
          "reducedTransferTime": {
            "title": "Reduced transfer time",
            "type": "boolean",
            "description": "Allow tighter connections than the default minimum interchange time.",
            "default": false
          },
          "increasedInterchange": {
            "title": "Extra transfer time",
            "enum": [
              "ZERO",
              "THIRTY_MINUTES",
              "SIXTY_MINUTES"
            ],
            "type": "string",
            "description": "Add a buffer to every interchange. Only these three values are accepted by the API.",
            "default": "ZERO"
          },
          "onlySearchForSleeper": {
            "title": "Sleeper services only",
            "type": "boolean",
            "description": "Restrict the search to overnight sleeper services (Caledonian Sleeper, Night Riviera).",
            "default": false
          },
          "overtakenTrains": {
            "title": "Include overtaken trains",
            "type": "boolean",
            "description": "Include slower services that are overtaken by a later, faster train.",
            "default": true
          },
          "useAlternativeServices": {
            "title": "Use alternative services",
            "type": "boolean",
            "description": "Let the planner include alternative (e.g. replacement or diverted) services.",
            "default": false
          },
          "includeAllFares": {
            "title": "Include all fares",
            "type": "boolean",
            "description": "If enabled, every fare offered for a journey is stored in the \"fares\" field, not just the cheapest ones.",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Maximum number of journeys to push to the dataset (paged ~5 per request).",
            "default": 20
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}