National Rail Tickets Scraper - UK Train Times & Fares avatar

National Rail Tickets Scraper - UK Train Times & Fares

Pricing

from $1.00 / 1,000 train connections

Go to Apify Store
National Rail Tickets Scraper - UK Train Times & Fares

National Rail Tickets Scraper - UK Train Times & Fares

Scrape National Rail tickets and UK train times: connections, operators, live delays and every fare in GBP for any GB route. $5 per 1,000 connections.

Pricing

from $1.00 / 1,000 train connections

Rating

0.0

(0)

Developer

Muhammad Afzal

Muhammad Afzal

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a month ago

Last modified

Features

Limited permissions

Share

National Rail Tickets Scraper returns UK train connections from the National Rail Journey Planner for any two stations in Great Britain, with scheduled and live departure and arrival times, changes, train operators, platforms, delays, and every ticket fare returned (ticket name, class, restriction code and GBP price). It is built for UK travel apps, fare researchers, commuter tools and AI agents, and costs $5.00 per 1,000 connections on the Apify Free plan plus a $0.005 start fee per run.

The Actor reads National Rail's public journey-planning service. It never logs in, books or buys tickets, and charges only for connections it saves.

What National Rail ticket and train time data does it return?

Each dataset row is one connection (one journey option, outbound or return).

FieldWhat it holds
connectionId, directionStable ID and outbound or return
origin, destinationStation name and 3-letter CRS code
departureScheduled, arrivalScheduledTimetable times, ISO 8601 with UK offset
departureRealtime, arrivalRealtime, status, delayMinutesLive running information when National Rail supplies it
durationMinutes, changes, direct, isOvertakenJourney summary; isOvertaken marks a slower train beaten by a later one
operatorsTrain operating companies (code and name)
cheapestFareThe lowest fare found for the connection
faresEvery fare: ticket code and name, category, class, restriction code, route code, GBP amount and undiscounted adult price
legsEach train's operator, boarding and alighting stations, platforms, times, status, delay and replacement-bus flag
serviceBulletinsUp to 10 disruption notices
search, sourceUrl, scrapedAtThe search that produced the row and a link to the same journey on National Rail

Each run also writes an OUTPUT record with outcome (DATA, EMPTY, PARTIAL, BLOCKED, REJECTED or FAILED), resolved stations, delivered and charged counts, and warnings.

When should you use it, and when not?

Use it when you need:

  • UK train times and National Rail fares for a route, for example London Euston to Manchester Piccadilly;
  • to compare Standard and First Class fares, or adult and child fares;
  • an outbound and a return search in one run;
  • live status and delays alongside the timetable for a planned journey.

Do not use it when:

How do I search UK train times and National Rail fares?

Enter two stations by name or CRS code, such as London Euston or EUS. The Actor picks an exact code or name match first, then the first station whose name starts with or contains your text.

  • departureDate is YYYY-MM-DD in UK time. Leave it empty to search tomorrow, which keeps saved Tasks evergreen. Words such as "tomorrow" are not accepted, and past dates are rejected.
  • departureTime (default 09:00) is the earliest departure, or the latest arrival when searchBy is arrival.
  • searchBy: departure (default) returns trains leaving at or after the time; arrival returns trains scheduled to arrive by the time, the latest arrival first. It applies to the return leg too.
  • returnDate and returnTime add reverse-direction connections; the return time defaults to the departure time.
  • adults (16 and over, 0-9) and children (5-15, 0-9) set the passengers; at least one is required.
  • fareClass keeps any, standard or first fares.
  • directOnly drops journeys with changes; includeOvertaken: false hides slower overtaken trains.
  • maxResults caps rows across both directions, from 1 to 20 (default 10).
{
"from": "London Euston",
"to": "Manchester Piccadilly",
"departureTime": "09:00",
"adults": 1,
"children": 0,
"fareClass": "any",
"directOnly": false,
"maxResults": 5
}

Use it from an AI assistant

National Rail Tickets Scraper works from Claude, ChatGPT, Cursor or any other MCP client through Apify's MCP server. Add https://mcp.apify.com/?tools=muhammadafzal/national-rail-train-ticket-connection-scraper as a server, and the assistant can call the Actor as one tool. Example prompt: "Find the next five direct trains from Edinburgh to London Kings Cross tomorrow after 07:00 and give me the cheapest Standard fare for each."

How do I run it from code?

JavaScript (apify-client):

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('muhammadafzal/national-rail-train-ticket-connection-scraper').call(
{ from: 'EUS', to: 'MAN', departureTime: '09:00', maxResults: 5 },
{ maxTotalChargeUsd: 0.1 },
);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((c) => `${c.departureScheduled} ${c.cheapestFare?.ticketName} £${c.cheapestFare?.amountGbp}`));

Python (apify-client 3.x):

import os
from decimal import Decimal
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("muhammadafzal/national-rail-train-ticket-connection-scraper").call(
run_input={"from": "EUS", "to": "MAN", "departureTime": "09:00", "maxResults": 5},
max_total_charge_usd=Decimal("0.10"),
)
for conn in client.dataset(run.default_dataset_id).iterate_items():
fare = conn.get("cheapestFare") or {}
print(conn["departureScheduled"], conn["changes"], fare.get("ticketName"), fare.get("amountGbp"))

Both examples raise the maximum cost per run to $0.10 so that all requested rows fit (see pricing below).

What does the output look like?

An illustrative row in the dataset's exact shape (values are an example, not a live quote; fares and legs are shortened).

{
"connectionId": "outbound-1-2026-11-20T09:13:00+00:00",
"direction": "outbound",
"origin": { "crsCode": "EUS", "name": "London Euston" },
"destination": { "crsCode": "MAN", "name": "Manchester Piccadilly" },
"departureScheduled": "2026-11-20T09:13:00+00:00",
"departureRealtime": null,
"arrivalScheduled": "2026-11-20T11:19:00+00:00",
"arrivalRealtime": null,
"durationMinutes": 126,
"changes": 0,
"direct": true,
"status": "OnTime",
"delayMinutes": null,
"isOvertaken": false,
"operators": [{ "code": "VT", "name": "Avanti West Coast" }],
"cheapestFare": { "ticketCode": "SVS", "ticketName": "Off-Peak Single", "fareClass": "STANDARD", "amountGbp": 79.8 },
"fares": [
{ "ticketCode": "SVS", "ticketName": "Off-Peak Single", "fareClass": "STANDARD", "amountGbp": 79.8 }
],
"legs": [
{ "legNumber": 1, "operatorName": "Avanti West Coast", "board": { "crsCode": "EUS", "name": "London Euston" }, "alight": { "crsCode": "MAN", "name": "Manchester Piccadilly" }, "replacementBus": false }
],
"sourceUrl": "https://www.nationalrail.co.uk/journey-planner/?type=single&origin=EUS&destination=MAN&…"
}

Pricing: how much does a National Rail search cost?

You pay per connection saved, plus a small start fee. Platform usage is included in these prices.

EventFREEBRONZESILVERGOLD
Train connection (primary event, per saved row)$0.005$0.005$0.005$0.001
Actor start (per started GB of allocated memory)$0.005$0.005$0.005$0.005

PLATINUM and DIAMOND plans pay the GOLD price. The default memory is 256 MB, so a normal run pays one start event.

Worked totals on the Free plan:

  • 10 connections (the default maxResults): $0.005 + 10 × $0.005 = $0.055.
  • 20 connections (the maximum): $0.005 + 20 × $0.005 = $0.105 (GOLD: $0.025).

The Actor's default run options set a maximum cost per run of $0.105, enough for the 20-row maximum at Free-plan prices. If you set a lower maximum, the run stops cleanly before the connection that would exceed it. Rejected inputs and empty searches charge no connection events.

How reliable is it, and what are its limits?

  • Apify's Store statistics show 27 of 27 runs succeeded in the 30 days before 2026-10-27.
  • One journey-planner request per direction, with capped retries on HTTP 429 and 5xx; at most 20 rows per run.
  • Railcard discounts are not applied.
  • Fares and live status are snapshots at scrapedAt; the official journey planner is the source of truth before purchase.
  • Access denials and throttling end the run as BLOCKED or PARTIAL, never with invented fares.

FAQ

Which fares does it return?

Every fare the National Rail Journey Planner returns for the connection, for example Advance, Off-Peak or Anytime singles, with ticket code, name, category, class, restriction code and GBP price. cheapestFare is the lowest one.

Can I apply a Railcard?

No. Fares come back without Railcard discounts, because eligibility has to be checked at purchase.

Can I search a return journey?

Yes. Add returnDate and, optionally, returnTime. Return rows have direction: "return", and maxResults covers both directions.

Does it show delays and cancellations?

Yes, when National Rail supplies live data: see departureRealtime, arrivalRealtime, status, delayMinutes, each leg's status, and serviceBulletins.

Can I use station codes instead of names?

Yes. Three-letter CRS codes such as EUS, MAN or KGX are matched first.

Does it buy or reserve tickets?

No. It reads public journey and fare data only. Open sourceUrl to continue on National Rail.

Can I search by arrival time?

Yes. Set searchBy to arrival and departureTime to the time you must arrive by. Only connections scheduled to arrive at or before that time are kept, latest arrival first.

Use the data for permitted research and journey planning at a reasonable volume, and respect National Rail's terms and UK law. Do not present scraped fares or live status as guaranteed, and do not use the data to automate ticket purchases. This Actor is independent and not affiliated with or endorsed by National Rail or the Rail Delivery Group.

Last verified: 2026-10-27