---
title: "Trainline API: Train Times and Fares as JSON | Perceptlayer"
description: "Trainline's partner API needs a commercial deal. 14 endpoints return stations, journeys and a fares calendar as JSON at 1 credit each, plus a month's fare cost."
url: https://perceptlayer.com/blog/trainline-api-train-times-fares
---

[Blog](https://perceptlayer.com/blog) / [API guides](https://perceptlayer.com/blog/category/api-guides)

# Trainline API: Train Times and Fares as JSON

20 Sept 2026 Perceptlayer 8 min read

Trainline's own API is sold to travel companies through Trainline Partner Solutions, with onboarding by contact and no self-serve sign-up. The Perceptlayer Trainline API is the read-only route: 14 GET endpoints return stations, journeys with times, ticket options and a fares calendar as JSON, each at 1 credit per successful call. The usual chain is `stations` to find the two stations, then `journeys` for a date or `fares-calendar` for a range of dates.

## Key takeaways

-   Trainline's Global API is a wholesale distribution product for travel sellers, booking tools and travel management companies, onboarded through its partnerships team.
-   Britain's National Rail Data Portal offers timetable and fares feeds for development, and the Darwin feeds give real-time running; neither returns Trainline's live journey prices.
-   `GET /v1/trainline/journeys` needs `origin`, `destination` and `date`, and takes `journey_type`, passenger counts, `transport_mode` ( `all`, `train`, `coach`) and `currency` ( `GBP`, `EUR`).
-   `GET /v1/trainline/fares-calendar` takes `origin`, `destination`, `date_from` and `date_to`, so a month of prices on one route can be one call and 1 credit.
-   We haven't recorded a Trainline response, so this guide gives the requests, the parameters and the costs, and names what to check in the playground.

## Is there an official Trainline API?

Yes, but not for individual developers. Trainline Partner Solutions sells the Trainline Global API to travel sellers, online travel agencies, travel management companies and corporate booking tools; Trainline's own announcements describe partners such as Egencia reaching rail content through it with one connection ( [Trainline Partner Solutions](https://tps.thetrainline.com/), 2026). Access starts with a conversation through its [partnerships page](https://www.thetrainline.com/about-us/partnerships), and it's built for selling tickets, not for reading prices.

For British rail, there's also open data. The National Rail Data Portal provides timetable data updated weekly and fares data updated three times a year for development and proof-of-concept work, and the Darwin feeds give real-time train running ( [Rail Delivery Group](https://www.raildeliverygroup.com/our-services/essential-services/real-time-train-journey-information.html), 2026). If you need the published fare tables or live departures, start there: it's the source the industry uses. Regular production feeds of fares data need a licence ( [Rail Delivery Group, RSP data](https://www.raildeliverygroup.com/our-services/rail-data/rsp-data.html), 2026).

What neither gives you is the price a traveller sees on Trainline for a given train on a given day, including advance fares, which is what the [Trainline API](https://perceptlayer.com/apis/trainline) returns. Data is collected from publicly available sources and returned as found at the time of the call.

| You need | Use |
| --- | --- |
| To sell rail tickets in your product | Trainline Partner Solutions |
| Timetables, published fare tables, live running in Britain | National Rail Data Portal and Darwin |
| Journey times and prices as shown on Trainline, as JSON | [`/v1/trainline/journeys`](https://perceptlayer.com/apis/trainline/journeys) and [`/v1/trainline/fares-calendar`](https://perceptlayer.com/apis/trainline/fares-calendar) |

## Which Trainline endpoints are there?

Fourteen, in four groups. Stations endpoints resolve names to stations. Journeys endpoints search a route and date and then drill into one search with its `search_id`. Fares endpoints return prices over a date range. Railcard endpoints list cards and their discounts. All are GET and all cost 1 credit on success.

| Group | Endpoints | Required parameters |
| --- | --- | --- |
| Stations | `stations`, `stations-nearby` | `query`; `station_id` |
| Journey search | `journeys` | `origin`, `destination`, `date` |
| One search, drilled into | `journeys-page`, `journeys-return`, `journeys-ticket-options`, `journeys-price-prediction`, `journeys-local-transport` | `search_id`, plus a journey ID where needed |
| One train | `journeys-calling-points` | `timetable_id`, `carrier`, `departure_time`, `origin`, `destination` |
| Fares over dates | `fares-calendar`, `fares-calendar-times` | `origin`, `destination`, `date_from`, `date_to` |
| No parameters | `fares-best`, `cards`, `cards-discounts` | none |

The full list, with each endpoint's page and playground, is on the [Trainline API page](https://perceptlayer.com/apis/trainline). The [travel APIs](https://perceptlayer.com/verticals/travel) cover flights and hotels on the same key.

## How do you find a station?

Call `GET /v1/trainline/stations` with `query`, a station or city name of up to 100 characters. `limit` caps the matches and `locale` sets the language of the names. This is the first call of every chain, because `origin` and `destination` on the journey and fare endpoints take a station, not free text. Put your key in the `X-API-Key` header; keys start with `sk_live_`, and the [authentication docs](https://docs.perceptlayer.com/authentication) cover the rest.

```bash
curl "https://api.perceptlayer.com/v1/trainline/stations?query=Manchester&limit=5" \
  -H "X-API-Key: $API_KEY"
```

We haven't recorded a stations response, so we can't name the field that holds the identifier to pass on as `origin` or `destination`, or show its format. Run the call in the playground on the Trainline API page first and note it. Station identifiers don't change, so look up the stations you track once and store them.

## How do you search journeys for a date?

Call `GET /v1/trainline/journeys` with `origin`, `destination` and `date`. The optional parameters cover a time of day, return trips ( `journey_type` of `single`, `return` or `open_return`, with `return_date` and `return_time`), passengers ( `adults`, `children`, `child_age`), `transport_mode` ( `all`, `train`, `coach`) and `currency` ( `GBP` or `EUR`).

```bash
curl "https://api.perceptlayer.com/v1/trainline/journeys?origin=$ORIGIN&destination=$DESTINATION&date=$DATE&journey_type=single&adults=1&currency=GBP" \
  -H "X-API-Key: $API_KEY"
```

The shell variables stand for values you take from the stations call and a date. The date and time formats aren't documented in the endpoint definition, so check them on the [Journeys endpoint page](https://perceptlayer.com/apis/trainline/journeys) before you script it. We haven't run this request for the article.

| Parameter | Type | Allowed values or notes |
| --- | --- | --- |
| `origin`, `destination` | string, required | Stations from the stations endpoint |
| `date` | string, required | Outbound date |
| `time` | string | Outbound time |
| `journey_type` | string | `single`, `return`, `open_return` |
| `return_date`, `return_time` | string | For returns |
| `adults`, `children` | integer | Passenger counts |
| `child_age` | integer |  |
| `transport_mode` | string | `all`, `train`, `coach` |
| `currency` | string | `GBP`, `EUR` |

### How do the follow-up journey endpoints use search\_id?

A journey search is a session you drill into. Each follow-up endpoint takes a `search_id` from a journeys response: `journeys-page` moves to the next or previous set of times ( `page` of `next` or `previous`, `direction` of `outward` or `inward`); `journeys-ticket-options` takes an `outward_journey_id`, and optionally an `inward_journey_id`, and returns the tickets for that pairing; `journeys-return` lists return options for an outward journey; and `journeys-price-prediction` takes a `journey_id`.

Every follow-up is another call at 1 credit. Fetching ticket options for ten departures on one day is one search plus ten calls, 11 credits. Without a recording we can't say how long a `search_id` stays valid, so run the follow-ups soon after the search and expect a stale ID to fail; failures cost nothing.

## How do you get a month of fares on one route?

Use `GET /v1/trainline/fares-calendar` with `origin`, `destination`, `date_from` and `date_to`, plus `currency` if you want `GBP` or `EUR` explicitly. It returns fares across the dates in the range, which is what you want for "when is it cheapest to travel" questions. `fares-calendar-times` takes the same parameters and, by its name, breaks fares down by departure time.

```bash
curl "https://api.perceptlayer.com/v1/trainline/fares-calendar?origin=$ORIGIN&destination=$DESTINATION&date_from=$DATE_FROM&date_to=$DATE_TO&currency=GBP" \
  -H "X-API-Key: $API_KEY"
```

We haven't recorded a fares-calendar response, so check two things in the [Fares Calendar playground](https://perceptlayer.com/apis/trainline/fares-calendar) before relying on it: whether a 30-day range comes back in one call or is cut short, and whether each day carries one cheapest fare or several. Both decide how many calls a month costs.

Two things limit what a fares calendar shows. Prices are as found at the time of the call, and advance fares change as trains fill, so a calendar is a snapshot, not a quote. And railcards and passenger types change the price a traveller pays; the [Cards](https://perceptlayer.com/apis/trainline/cards) and Cards Discounts endpoints list the railcards Trainline offers.

## What does it cost to scan a month of fares?

Every Trainline endpoint costs 1 credit per successful call, and failed calls cost nothing and return `X-Credits-Used: 0`. If one `fares-calendar` call covers a month, a month of fares on one route is 1 credit. If the range turns out to be shorter, split it, for example into weeks at about 5 calls a month. The [credits docs](https://docs.perceptlayer.com/credits) explain billing.

| Job | Calls | Credits |
| --- | --- | --- |
| A month of fares, one route, one call | 1 | 1 |
| The same, split into weekly ranges | 5 | 5 |
| Daily journey search for 30 days, one route | 30 | 30 |
| One day: search plus ticket options for 10 departures | 11 | 11 |
| 50 routes, a monthly calendar each, re-checked daily | 1,500 a month | 1,500 |

Worked example: tracking 50 routes with one fares-calendar call per route per day is 50 × 30 = 1,500 calls a month, so 1,500 credits, once you've confirmed one call covers your range. The 100 free credits you get once, after verifying an email address, cover the first 2 days of the 50-route job (2 × 50 = 100), enough to test it. A Starter pack of 10,000 credits covers the 50-route job for six months, and purchased credits last 12 months. See [pricing](https://perceptlayer.com/pricing) for what credits cost.

Free accounts run at 1 request a second and paid packs at 5 or more, shared by all of an account's keys; the [rate limits docs](https://docs.perceptlayer.com/rate-limits) have the details. For the same snapshot-versus-quote caution applied to air fares, see [flight price data for fare tracking](https://perceptlayer.com/blog/flight-price-data-fare-tracking).

## Can an AI agent plan rail trips with it?

Yes. The MCP server at `https://perceptlayer.com/mcp` exposes `search_endpoints` and `get_endpoint`, which are free catalogue lookups, and `call_endpoint`, which runs a Trainline endpoint and spends 1 credit on success. An agent can resolve two station names, search journeys for a date and compare a week of fares, in four or five calls.

Tell the agent to quote prices as "seen at the time of the search", not as bookable. Our [AI travel planning agent](https://perceptlayer.com/blog/ai-travel-planning-agent-mcp) tutorial shows the pattern with flights and hotels. Setup is in the [AI agents docs](https://docs.perceptlayer.com/ai-agents), and error codes are in the [errors docs](https://docs.perceptlayer.com/errors).

To see the real responses, [get a free API key](https://perceptlayer.com/signup) and run a stations search in the playground on the [Trainline API page](https://perceptlayer.com/apis/trainline).

## APIs in this post

-   [Trainline **1 credit per call** · 15 endpoints](https://perceptlayer.com/apis/trainline)

## Frequently asked questions

### Does Trainline have a public API?

Not a self-serve one. Trainline Partner Solutions sells its Global API to travel sellers, booking tools and travel management companies, with onboarding through its partnerships team. For British timetables, published fares and live running, the National Rail Data Portal and Darwin feeds are the open-data route. For journey times and prices as Trainline shows them, the Perceptlayer [Trainline API](https://perceptlayer.com/apis/trainline) returns JSON.

### How much does the Trainline API cost?

Each of the 14 Trainline endpoints costs 1 credit per successful call, and failed calls cost nothing. A fares calendar for one route can be a single call. Every account gets 100 free credits after verifying an email address, and prepaid packs start at 10,000 credits. The [pricing page](https://perceptlayer.com/pricing) has what credits cost.

### Can I book tickets through it?

No. The endpoints read stations, journeys, ticket options, fares and railcards; none of them books or holds a ticket. Prices are returned as found at the time of the call, and advance fares change as trains fill. To sell tickets in your own product, talk to Trainline Partner Solutions.

### Which currencies are supported?

The journey and fare endpoints take an optional `currency` of `GBP` or `EUR`. Set it on every call so prices from different runs compare directly. Railcards change what a traveller pays; the `cards` and `cards-discounts` endpoints list the cards and discounts Trainline offers.

### What happens if a call fails?

You get an HTTP status and a JSON error with a `code`, `message` and `request_id`, and nothing is debited. A missing `origin`, `destination` or `date` returns `invalid_parameters` (422), and a `currency` other than `GBP` or `EUR` does too. Rate-limited (429) and temporarily unavailable (503) responses carry `Retry-After`. The [errors docs](https://docs.perceptlayer.com/errors) list every code.

trainline train fares rail data uk rail travel api

## More from the blog

1.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Depop API: Resale Listings as JSON](https://perceptlayer.com/blog/depop-api-json)
    
    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total\_count of 6,815,522. 1 credit.
    
2.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Similarweb API: Website Traffic Data as JSON](https://perceptlayer.com/blog/similarweb-api-json)
    
    Get Similarweb traffic estimates as JSON: visits, bounce\_rate, traffic\_sources, top\_countries and top\_keywords for a domain, at 1 credit a call.
    
3.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [StockTwits API: Symbol Streams as JSON](https://perceptlayer.com/blog/stocktwits-api-json)
    
    Three StockTwits endpoints as JSON: a symbol's message stream with sentiment and cursor, symbol search and trending symbols, each 1 credit a call.
