Discover/trainline.eu API
live

trainline.eu APItrainline.eu

Search Trainline stations by name and find train journeys across the UK and Europe. Returns URNs, schedules, duration, distance, and CO2 data.

Endpoints
2
Updated
10d ago
Try it
Station name or partial name to search for (e.g. 'London', 'Manchester', 'Paris').
api.parse.bot/scraper/447b13bc-e3c7-4dca-a183-dbdaa6edee8a/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Use it in your codegrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/447b13bc-e3c7-4dca-a183-dbdaa6edee8a/search_locations?query=Berlin' \
  -H 'X-API-Key: $PARSE_API_KEY'
All endpoints · 2 totalclick to expand

Search for train station locations by name. Returns station URNs, coordinates, and metadata that can be used as origin/destination in search_journeys.

Input
ParamTypeDescription
queryrequiredstringStation name or partial name to search for (e.g. 'London', 'Manchester', 'Paris').
Response
{
  "type": "object",
  "fields": {
    "locations": "array of station objects with name, urn, country, type, timezone, latitude, longitude"
  },
  "sample": {
    "data": {
      "locations": [
        {
          "urn": "urn:trainline:generic:loc:MAN2968gb",
          "name": "Manchester Piccadilly",
          "type": "station",
          "country": "GB",
          "latitude": 53.4767,
          "timezone": "Europe/London",
          "longitude": -2.229
        },
        {
          "urn": "urn:trainline:generic:loc:115gb",
          "name": "Manchester",
          "type": "stationGroup",
          "country": "GB",
          "latitude": null,
          "timezone": "Europe/London",
          "longitude": null
        }
      ]
    },
    "status": "success"
  }
}

About the trainline.eu API

The Trainline EU API provides 2 endpoints for discovering train stations and searching available journeys across the UK and Europe. Use search_locations to resolve station names to URNs, then pass those URNs to search_journeys to retrieve journey schedules with departure and arrival times, total duration, distance in kilometres, and CO2 emissions per journey.

Station Search

The search_locations endpoint accepts a query string — a full or partial station name such as London, Manchester, or Paris — and returns an array of matching station objects. Each object includes a name, a urn (e.g. urn:trainline:generic:loc:182gb), country, type, timezone, and geographic coordinates (latitude, longitude). The URN is the key identifier used as origin or destination in journey searches.

Journey Search

The search_journeys endpoint accepts origin and destination as station URNs obtained from search_locations. An optional departure_date parameter accepts ISO 8601 format: either YYYY-MM-DD (which defaults departure time to 09:00) or a full datetime string YYYY-MM-DDTHH:MM. The response includes a total count and a journeys array. Each journey object carries id, departure_time, arrival_time, duration, direction, distance_km, co2_grams, and num_legs.

Coverage and Data Shape

Station coverage spans UK and European networks as indexed on Trainline.com. The CO2 emissions field (co2_grams) makes the API useful for comparing journeys on environmental impact alongside schedule and distance. The num_legs field indicates how many segments a journey involves, letting you distinguish direct services from those requiring changes.

Common use cases
  • Build a train journey planner that compares travel times between UK cities using departure and arrival fields
  • Display CO2 emissions per route to help users choose lower-carbon journeys
  • Resolve station names to URNs for use in downstream booking or scheduling workflows
  • Calculate travel distance between European cities using the distance_km field
  • Filter multi-leg vs direct journeys by inspecting the num_legs field
  • Populate an autocomplete station selector using search_locations with partial name queries
  • Aggregate journey duration data across multiple departure times to find the fastest available service
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000250 req/min

One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does Trainline have an official developer API?+
Trainline does not publish a public developer API. There is no documented REST or GraphQL API available for external developers on their website.
What does search_journeys return beyond schedule times?+
Each journey object includes departure_time, arrival_time, duration, direction, distance_km, co2_grams, and num_legs. It does not include real-time pricing or ticket availability — the API covers schedule and route metadata. You can fork it on Parse and revise to add a ticket price endpoint if that data becomes accessible.
Does the API return fare or ticket pricing for journeys?+
Not currently. The API returns schedule data, distance, and CO2 emissions but does not include fare prices or ticket classes. You can fork it on Parse and revise to add pricing fields if you need cost data alongside schedules.
Are there any limitations on the departure_date parameter?+
The departure_date field is optional and accepts either YYYY-MM-DD (defaulting to 09:00 departure) or a full ISO 8601 datetime string. Queries for historical dates or very far future dates may return no results depending on what Trainline has indexed for that route and time window.
Does the API cover all European train operators?+
Coverage reflects what Trainline.com indexes, which includes major UK and European rail networks. Smaller regional operators or networks not listed on Trainline may not appear in results. You can fork it on Parse and revise to integrate additional rail data sources if you need broader operator coverage.
Page content last updated . Spec covers 2 endpoints from trainline.eu.
Related APIs in TravelSee all →
opentable.ca API
Search and discover restaurants on OpenTable, view detailed information like menus and reviews, and check real-time dining availability across metro areas. Find top-rated restaurants in your location and instantly see which tables are open for your preferred date and time.
fandango.com API
Search for movies and retrieve nearby theater listings with showtimes by ZIP code and date, plus showtimes for a specific movie at nearby theaters.
data.lime.bike API
Access real-time availability data for Lime bikes and scooters, including station locations, vehicle status, system alerts, and geofencing zones across multiple cities. Monitor micromobility inventory and service information to find nearby vehicles or plan your trips effectively.
turo.com API
Search for peer-to-peer car rentals across Turo by location and dates to browse available vehicles with pricing, specifications, and real-time availability. Get detailed information on specific cars to compare features and make rental decisions.
reservation.pc.gc.ca API
Access real-time campground availability and reservation data from the Parks Canada booking system. Search locations, retrieve available campsites and cabins, filter by equipment type, and review operating date schedules across the national park network. Includes detailed resource metadata and map-based availability overviews.
bahn.com API
Search German train schedules and stations, find connections between destinations, and compare ticket prices across Deutsche Bahn routes. Get real-time station information and transit association details to plan your train journey efficiently.
united.com API
Search United Airlines flights, check real-time flight status, and view detailed seat maps to plan your perfect trip. Compare fare options and use airport autocomplete to quickly find your departure and arrival cities.
thetrainline.com API
Search UK train stations and find the cheapest fares across date ranges, then generate direct booking links to complete your purchase on Trainline.com. Get real-time journey information to compare prices and book your tickets in seconds.