Trainline Price Prediction API Documentation Read how the advance fare of a journey changes as the date of travel comes closer. Each tier has the fare name, the price, the period in which it is sold and the tickets left when known. The selected tier is the one you can buy now. Standard and first class are listed on their own.
Run this endpoint
Endpoint
Parameters
Start with the required fields, then add optional filters only when your use case needs them.
Runnable path
2 required parameters needed before sending a request.
1 optional filter available.
string
Required
search_id of a journey search answer.
1234567890
string
Required
id of the outward journey.
1234567890
string
Optional
GBP or EUR. Use the same value as in the search.
USD
Response Schema
Example response fields are illustrative; inspect the JSON before integrating.
Example response fields
Scan these fields before integrating.
data
meta
success
{
"data": {
"first": {
"price_tiers": [
{
"price": {
"amount": 125,
"currency": "GBP"
},
"selected": true,
"fare_name": "Advance Single (1st Class)",
"available_to": "2026-10-29T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-20T00:00:00+00:00",
"tickets_remaining": null
},
{
"price": {
"amount": 135,
"currency": "GBP"
},
"selected": false,
"fare_name": "Advance Single (1st Class)",
"available_to": "2026-10-29T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-29T00:00:00+00:00",
"tickets_remaining": null
},
{
"price": {
"amount": 231,
"currency": "GBP"
},
"selected": false,
"fare_name": "Advance Single (1st Class)",
"available_to": "2026-10-31T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-29T00:00:00+00:00",
"tickets_remaining": null
}
],
"selected_alternative_id": "fc270a65-1f63-4bda-91dc-1d338c09751c"
},
"standard": {
"price_tiers": [
{
"price": {
"amount": 43.5,
"currency": "GBP"
},
"selected": true,
"fare_name": "Advance Single",
"available_to": "2026-10-27T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-20T00:00:00+00:00",
"tickets_remaining": null
},
{
"price": {
"amount": 45.5,
"currency": "GBP"
},
"selected": false,
"fare_name": "Advance Single",
"available_to": "2026-10-27T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-27T00:00:00+00:00",
"tickets_remaining": null
},
{
"price": {
"amount": 46,
"currency": "GBP"
},
"selected": false,
"fare_name": "Advance Single",
"available_to": "2026-10-27T00:00:00+00:00",
"day_of_travel": false,
"available_from": "2026-10-27T00:00:00+00:00",
"tickets_remaining": null
}
],
"selected_alternative_id": "6f3c35e3-7877-42a1-a1c9-72f338b722bc"
},
"search_id": "1ab6ab81-b316-4f2e-ba21-df3055a8e3cc",
"journey_id": "785924f2-9819-4468-9ca7-eee4855546bd"
},
"meta": {
"billable": true,
"endpoint_family": "journeys_price_prediction"
},
"success": true
}
Errors
Handle these documented responses before retrying or showing customer-facing failures.
Validation Error
A required parameter is missing or invalid. This response is not billable.
{
"errors": {
"origin": [
"The origin is a station id from the stations endpoint."
]
},
"message": "The request validation failed"
}Resource Not Found
The search id or the journey id is unknown or has expired. This response is not billable.
{
"meta": {
"billable": false,
"retryable": false,
"endpoint_family": "journeys_price_prediction"
},
"error": {
"code": "NOT_FOUND",
"message": "Trainline found no match. Use station ids from the stations endpoint and ids from a fresh search."
},
"success": false
}Upstream Unavailable
Trainline did not answer in time. Scrappa retries on other exits first. This response is not billable. Retry after a few seconds.
{
"meta": {
"billable": false,
"retryable": true,
"endpoint_family": "journeys_price_prediction"
},
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "The Trainline service is temporarily unavailable. Please retry."
},
"success": false
}Generate Code with AI
Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.
Try It Live
Test this endpoint in our interactive playground with real data.