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
28d 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 →
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.
nationalrail.co.uk API
Check live train departure and arrival times at UK stations, search for specific stations, and get real-time service disruption alerts. Stay informed about rail service delays and changes to plan your journeys efficiently.
trenitalia.com API
Search for trains across Italy, check real-time train status and delays, view station departure and arrival boards, and find available tickets all in one place. Get live traffic information and detailed train itineraries to plan your journey with complete visibility into schedules and service disruptions.
railyatri.in API
Search trains between stations and get real-time information including live train status, timetables, seat availability, and PNR confirmation details. Find the perfect journey by autocompleting station and train names while checking current availability and train schedules.
bahn.de API
bahn.de API
amtrak.com API
Search for Amtrak trains across stations, compare fares, and discover discounts to plan your rail journey with current pricing and availability. Get detailed train information, autocomplete station names, and find the cheapest routes for your travel dates.
omio.com API
Search and compare train, bus, and flight trips across multiple providers in real-time, with detailed pricing breakdowns and the ability to view fares across different dates. Find the best deals by exploring popular destinations, autocompleting location searches, and analyzing price variations to plan your ideal journey.
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.