Skip to content
Scrappa Get API key
Trainline API 1 credit/request

Trainline Journeys API Documentation

GET https://scrappa.co/api/trainline/journeys

Trainline Journeys API Documentation Search rail and coach journeys between two stations. Each journey has its legs with stations, times, platforms, carrier, train number and timetable id, the duration, the distance, the number of changes and the CO2 estimate. Each journey carries offers: every purchasable fare with its name, travel class, availability, conditions, extras and prices. total_price is the price for all passengers and per_passenger_price is the fare of one passenger. changes counts the legs minus one. fare_change_conditions lists the exchange and refund texts of the fare. A return between UK stations returns both directions in one call. For a continental return, requires_inward_call is true: call the return endpoint for the way back. Use search_id with the page endpoint to read more journeys.

Trainline Journeys API Documentation 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/trainline/journeys
Auth header
x-api-key
Cost
1 credit/request
origin = example destination = example date = 2026-06-15
Response preview
200 OK
{
    "data": {
        "origin": "urn:trainline:generic:loc:EUS1444gb",
        "currency": "GBP",
        "journeys": [
            {
                "id": "785924f2-9819-4468-9ca7-eee4855546bd",
                "legs": [
                    {
                        "origin": {
                            "code": "urn:trainline:atoc:loc:EUS1444",
                            "name": "London Euston",
                            "latitude": 51.5284,
                            "timezone": "Europe/London",
...

Parameters

Start with the required fields, then add optional filters only when your use case needs them.

Runnable path

3 required parameters needed before sending a request.

9 optional filters available.

origin string Required

Origin station id from the stations endpoint. Example: urn:trainline:generic:loc:EUS1444gb.

Example value example
destination string Required

Destination station id from the stations endpoint. Example: urn:trainline:generic:loc:MAN2968gb.

Example value example
date string Required

Travel date, YYYY-MM-DD, today or later and inside the booking horizon of about 178 days.

Example value 2026-06-15
time string Optional

Earliest departure time, HH:MM. Defaults to 09:00.

Example value example
journey_type string Optional

single, return or open_return. Defaults to single. A return needs return_date.

Example value example
return_date string Optional

Return travel date, YYYY-MM-DD. Required for a return.

Example value 2026-06-15
return_time string Optional

Earliest return departure time, HH:MM. Defaults to 09:00.

Example value example
adults integer Optional

Adults aged 16 and over, 1 to 9. Defaults to 1.

Example value 10
children integer Optional

Children, 0 to 9. Adults and children together are at most 9.

Example value 10
child_age integer Optional

Age of all children, 0 to 15. Defaults to 8.

Example value 10
transport_mode string Optional

all, train or coach. train drops every journey that has a leg by another mode. Defaults to all.

Example value example
currency string Optional

GBP or EUR. Defaults to GBP. Use EUR for continental routes.

Example value USD

Response Schema

Example response fields are illustrative; inspect the JSON before integrating.

Example response fields

Scan these fields before integrating.

data meta success
JSON Response
200 OK
{
    "data": {
        "origin": "urn:trainline:generic:loc:EUS1444gb",
        "currency": "GBP",
        "journeys": [
            {
                "id": "785924f2-9819-4468-9ca7-eee4855546bd",
                "legs": [
                    {
                        "origin": {
                            "code": "urn:trainline:atoc:loc:EUS1444",
                            "name": "London Euston",
                            "latitude": 51.5284,
                            "timezone": "Europe/London",
                            "longitude": -0.1346,
                            "short_code": "EUS",
                            "country_code": "GB"
                        },
                        "carrier": {
                            "code": "urn:trainline:atoc:carrier:VT",
                            "name": "Avanti West Coast"
                        },
                        "cancelled": false,
                        "reservable": true,
                        "destination": {
                            "code": "urn:trainline:atoc:loc:MAN2968",
                            "name": "Manchester Piccadilly",
                            "latitude": 53.4767,
                            "timezone": "Europe/London",
                            "longitude": -2.229,
                            "short_code": "MAN",
                            "country_code": "GB"
                        },
                        "distance_km": 280,
                        "arrival_time": "2026-11-03T11:19:00+00:00",
                        "timetable_id": "W34038",
                        "train_number": "VT705500",
                        "departure_time": "2026-11-03T09:13:00+00:00",
                        "transport_mode": "train",
                        "arrival_platform": "5",
                        "bike_restriction": "ALLOWEDWITHRESERVATION",
                        "duration_minutes": 126,
                        "departure_platform": "2",
                        "replacement_service": false,
                        "reservation_mandatory": true
                    }
                ],
                "offers": [
                    {
                        "id": "1255d59b-8f81-47ad-8174-a5c78999f34a",
                        "fares": [
                            {
                                "id": "757f730c-41ca-4835-9213-905be875207e",
                                "code": "urn:trainline:atoc:fare:SOS",
                                "name": "Anytime Single",
                                "tags": [
                                    "flex:anytime",
                                    "refundable:yes"
                                ],
                                "price": {
                                    "amount": 193,
                                    "currency": "GBP"
                                },
                                "terms": [
                                    "urn:trainline:noncon:atoc:rfndbl",
                                    "urn:trainline:noncon:atoc:anytime"
                                ],
                                "category": "Peak",
                                "passengers": 1,
                                "valid_until": {
                                    "inward": null,
                                    "outward": "2026-11-05T04:30:00+00:00"
                                },
                                "availability": {
                                    "status": "AVAILABLE",
                                    "remaining": null
                                },
                                "travel_class": "Standard",
                                "passenger_types": [
                                    {
                                        "name": "Adult",
                                        "max_age": null,
                                        "min_age": 16
                                    }
                                ],
                                "validity_period": "P2D",
                                "delivery_methods": [
                                    "AtocMTicket",
                                    "AtocETicket",
                                    "AtocKiosk",
                                    "AtocUkSecondClassPost",
                                    "AtocUKInternationalPost",
                                    "AtocUKSpecialDelivery",
                                    "AtocIndirectETicket"
                                ],
                                "route_restriction": "Travel is allowed via any permitted route.",
                                "per_passenger_price": {
                                    "amount": 193,
                                    "currency": "GBP"
                                }
                            }
                        ],
                        "vendor": "UK National Rail",
                        "fare_code": "urn:trainline:atoc:fare:SOS",
                        "fare_name": "Anytime Single",
                        "full_price": {
                            "amount": 193,
                            "currency": "GBP"
                        },
                        "section_id": "e0e2d381-3327-4246-8b6d-8e01c5e3d488",
                        "description": "Travel any time of day.",
                        "total_price": {
                            "amount": 193,
                            "currency": "GBP"
                        },
                        "travel_classes": [
                            "Standard"
                        ],
                        "included_extras": [
                            {
                                "name": "Allocated seating",
                                "group": "seatSelection",
                                "quantity": 1
                            },
                            {
                                "name": "WiFi",
                                "group": "wifi",
                                "quantity": 1
                            },
                            {
                                "name": "Power socket",
                                "group": "electricSocket",
                                "quantity": 1
                            },
                            {
                                "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                                "group": "luggage",
                                "quantity": 1
                            }
                        ],
                        "available_extras": [
                            {
                                "name": "Bike",
                                "group": "bicycle",
                                "quantity": 3
                            },
                            {
                                "name": "Allocated seating",
                                "group": "seatSelection",
                                "quantity": 1
                            },
                            {
                                "name": "WiFi",
                                "group": "wifi",
                                "quantity": 1
                            },
                            {
                                "name": "Power socket",
                                "group": "electricSocket",
                                "quantity": 1
                            },
                            {
                                "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                                "group": "luggage",
                                "quantity": 1
                            }
                        ],
                        "fare_change_conditions": [
                            "Flexible ticket with no time restrictions on when you can travel.",
                            "Your journey must be on the date, or the day after the date, specified on the ticket.",
                            "Can be booked in advance or purchased on the day of travel.",
                            "Refundable until 23:59 the day before the ticket becomes valid for travel. Non-refundable if purchased on the day of travel.",
                            "If you wish to travel on a date outside of the ticket validity period or change the Class of ticket, you will need to buy a new ticket and apply for a refund on your current ticket.",
                            "Yes - normal railcard and child discounts available.",
                            "You may start, break and resume, or end your journey at any intermediate station along the route of travel.",
                            "Mobile Tickets and etickets aren't valid for travel on London Underground. See our FAQs for more info.",
                            "SOS",
                            "View information about wheelchair spaces and accessibility on board your train here www.nationalrail.co.uk/on-the-train/accessible-train-travel-and-facilities. Find out how to book travel assistance here www.nationalrail.co.uk/help-and-assistance/passenger-assist."
                        ],
                        "requires_travel_together": false
                    },
                    {
                        "id": "cd15c147-83f2-4e4f-856a-6dd91d5c9704",
                        "fares": [
                            {
                                "id": "f880bc96-b00a-4f42-a8a3-42d80804310e",
                                "code": "urn:trainline:atoc:fare:FOS",
                                "name": "Anytime Single (1st Class)",
                                "tags": [
                                    "flex:anytime",
                                    "refundable:yes"
                                ],
                                "price": {
                                    "amount": 290,
                                    "currency": "GBP"
                                },
                                "terms": [
                                    "urn:trainline:noncon:atoc:rfndbl",
                                    "urn:trainline:noncon:atoc:anytime"
                                ],
                                "category": "Peak",
                                "passengers": 1,
                                "valid_until": {
                                    "inward": null,
                                    "outward": "2026-11-05T04:30:00+00:00"
                                },
                                "availability": {
                                    "status": "AVAILABLE",
                                    "remaining": null
                                },
                                "travel_class": "First",
                                "passenger_types": [
                                    {
                                        "name": "Adult",
                                        "max_age": null,
                                        "min_age": 16
                                    }
                                ],
                                "validity_period": "P2D",
                                "delivery_methods": [
                                    "AtocMTicket",
                                    "AtocETicket",
                                    "AtocKiosk",
                                    "AtocUkSecondClassPost",
                                    "AtocUKInternationalPost",
                                    "AtocUKSpecialDelivery",
                                    "AtocIndirectETicket"
                                ],
                                "route_restriction": "Travel is allowed via any permitted route.",
                                "per_passenger_price": {
                                    "amount": 290,
                                    "currency": "GBP"
                                }
                            }
                        ],
                        "vendor": "UK National Rail",
                        "fare_code": "urn:trainline:atoc:fare:FOS",
                        "fare_name": "Anytime Single (1st Class)",
                        "full_price": {
                            "amount": 290,
                            "currency": "GBP"
                        },
                        "section_id": "e0e2d381-3327-4246-8b6d-8e01c5e3d488",
                        "description": "Travel any time of day.",
                        "total_price": {
                            "amount": 290,
                            "currency": "GBP"
                        },
                        "travel_classes": [
                            "First"
                        ],
                        "included_extras": [
                            {
                                "name": "Allocated seating",
                                "group": "seatSelection",
                                "quantity": 1
                            },
                            {
                                "name": "WiFi",
                                "group": "wifi",
                                "quantity": 1
                            },
                            {
                                "name": "Power socket",
                                "group": "electricSocket",
                                "quantity": 1
                            },
                            {
                                "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                                "group": "luggage",
                                "quantity": 1
                            },
                            {
                                "name": "At seat service",
                                "group": "meal",
                                "quantity": 1
                            },
                            {
                                "name": "Comfier seats",
                                "group": "extraLegroom",
                                "quantity": 1
                            },
                            {
                                "name": "Table seat",
                                "group": "firstClassComfort",
                                "quantity": 1
                            },
                            {
                                "name": "Complimentary food and drink",
                                "group": "drinksAndSnacks",
                                "quantity": 1
                            },
                            {
                                "name": "1st class lounge",
                                "group": "departureLounge",
                                "quantity": 1
                            }
                        ],
                        "available_extras": [
                            {
                                "name": "Bike",
                                "group": "bicycle",
                                "quantity": 3
                            },
                            {
                                "name": "Allocated seating",
                                "group": "seatSelection",
                                "quantity": 1
                            },
                            {
                                "name": "WiFi",
                                "group": "wifi",
                                "quantity": 1
                            },
                            {
                                "name": "Power socket",
                                "group": "electricSocket",
                                "quantity": 1
                            },
                            {
                                "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                                "group": "luggage",
                                "quantity": 1
                            },
                            {
                                "name": "At seat service",
                                "group": "meal",
                                "quantity": 1
                            },
                            {
                                "name": "Comfier seats",
                                "group": "extraLegroom",
                                "quantity": 1
                            },
                            {
                                "name": "Table seat",
                                "group": "firstClassComfort",
                                "quantity": 1
                            },
                            {
                                "name": "Complimentary food and drink",
                                "group": "drinksAndSnacks",
                                "quantity": 1
                            },
                            {
                                "name": "1st class lounge",
                                "group": "departureLounge",
                                "quantity": 1
                            }
                        ],
                        "fare_change_conditions": [
                            "Flexible ticket with no time restrictions on when you can travel.",
                            "Your journey must be on the date, or the day after the date, specified on the ticket.",
                            "Can be booked in advance or purchased on the day of travel.",
                            "Refundable until 23:59 the day before the ticket becomes valid for travel. Non-refundable if purchased on the day of travel.",
                            "If you wish to travel on a date outside of the ticket validity period or change the Class of ticket, you will need to buy a new ticket and apply for a refund on your current ticket.",
                            "Yes - normal railcard and child discounts available.",
                            "Only Senior, Disabled Persons and HM Forces Railcards secure discounts in First Class, and, subject to time restriction, the Two Together Railcard.",
                            "You may start, break and resume, or end your journey at any intermediate station along the route of travel.",
                            "Mobile Tickets and etickets aren't valid for travel on London Underground. See our FAQs for more info.",
                            "FOS",
                            "View information about wheelchair spaces and accessibility on board your train here www.nationalrail.co.uk/on-the-train/accessible-train-travel-and-facilities. Find out how to book travel assistance here www.nationalrail.co.uk/help-and-assistance/passenger-assist."
                        ],
                        "requires_travel_together": false
                    }
                ],
                "changes": 0,
                "carriers": [
                    {
                        "code": "urn:trainline:atoc:carrier:VT",
                        "name": "Avanti West Coast"
                    }
                ],
                "sellable": true,
                "co2_grams": 9828,
                "distance_km": 280,
                "arrival_time": "2026-11-03T11:19:00+00:00",
                "departure_time": "2026-11-03T09:13:00+00:00",
                "live_confidence": "Possible",
                "bike_restriction": "ALLOWEDWITHRESERVATION",
                "duration_minutes": 126,
                "unsellable_reason": null,
                "cheapest_total_price": {
                    "amount": 43.5,
                    "currency": "GBP"
                }
            }
        ],
        "warnings": null,
        "search_id": "1ab6ab81-b316-4f2e-ba21-df3055a8e3cc",
        "expires_at": "2026-10-20T15:57:57+00:00",
        "destination": "urn:trainline:generic:loc:MAN2968gb",
        "journey_type": "single",
        "journey_count": 1,
        "transport_mode": "all",
        "inward_journeys": null,
        "requires_inward_call": false
    },
    "meta": {
        "billable": true,
        "endpoint_family": "journeys"
    },
    "success": true
}

Errors

Handle these documented responses before retrying or showing customer-facing failures.

422

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"
}
404

Resource Not Found

The station ids are unknown or no journey is offered between these stations. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": false,
        "endpoint_family": "journeys"
    },
    "error": {
        "code": "NOT_FOUND",
        "message": "Trainline found no match. Use station ids from the stations endpoint and ids from a fresh search."
    },
    "success": false
}
503

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"
    },
    "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.