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

Trainline Ticket Options API Documentation

GET https://scrappa.co/api/trainline/journeys/ticket-options

Trainline Ticket Options API Documentation Read the ticket products for a journey, such as Advance Single, Off-Peak Single and Anytime Single. Each product has the price for all passengers, the refund, cancellation and exchange terms, the restrictions, the full condition texts and the offers it covers. The classes list the cheapest price per travel class and the services of the class, such as seat reservation, luggage, power socket and WiFi.

Trainline Ticket Options API Documentation 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/trainline/journeys/ticket-options
Auth header
x-api-key
Cost
1 credit/request
search_id = 1234567890 outward_journey_id = 1234567890
Response preview
200 OK
{
    "data": {
        "currency": "GBP",
        "search_id": "1ab6ab81-b316-4f2e-ba21-df3055a8e3cc",
        "ticket_classes": [
            {
                "code": "urn:trainline:atoc:class:Standard",
                "name": "Standard",
                "services": [
                    {
                        "name": "Allocated seating",
                        "group": "seatSelection"
                    },
                    {
...

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.

2 optional filters available.

search_id string Required

search_id of a journey search answer.

Example value 1234567890
outward_journey_id string Required

id of the outward journey.

Example value 1234567890
inward_journey_id string Optional

id of the return journey, for a return search.

Example value 1234567890
currency string Optional

GBP or EUR. Use the same value as in the search.

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": {
        "currency": "GBP",
        "search_id": "1ab6ab81-b316-4f2e-ba21-df3055a8e3cc",
        "ticket_classes": [
            {
                "code": "urn:trainline:atoc:class:Standard",
                "name": "Standard",
                "services": [
                    {
                        "name": "Allocated seating",
                        "group": "seatSelection"
                    },
                    {
                        "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                        "group": "luggage"
                    },
                    {
                        "name": "Power socket",
                        "group": "electricSocket"
                    },
                    {
                        "name": "WiFi",
                        "group": "wifi"
                    }
                ],
                "cheapest_price": {
                    "amount": 43.5,
                    "currency": "GBP"
                },
                "ticket_option_ids": [
                    "hxlMwq2mLks=",
                    "HygkdUTu6Xk="
                ]
            },
            {
                "code": "urn:trainline:atoc:class:premium",
                "name": "Premium",
                "services": [
                    {
                        "name": "Table seat",
                        "group": "firstClassComfort"
                    },
                    {
                        "name": "Comfier seats",
                        "group": "extraLegroom"
                    },
                    {
                        "name": "Allocated seating",
                        "group": "seatSelection"
                    },
                    {
                        "name": "1 suitcase (max 30x70x90cm), 1 small carry-on bag, 1 handbag",
                        "group": "luggage"
                    },
                    {
                        "name": "Power socket",
                        "group": "electricSocket"
                    },
                    {
                        "name": "WiFi",
                        "group": "wifi"
                    }
                ],
                "cheapest_price": {
                    "amount": 83,
                    "currency": "GBP"
                },
                "ticket_option_ids": [
                    "mOL87jh9kuw="
                ]
            }
        ],
        "ticket_options": [
            {
                "id": "hxlMwq2mLks=",
                "name": "Advance Single",
                "type": "NonFlexible",
                "refunds": "No refunds",
                "exchanges": null,
                "conditions": [
                    {
                        "text": "Non-refundable ticket, only valid for the date, time and trains specified.",
                        "title": "DESCRIPTION"
                    },
                    {
                        "text": "You must travel on the date, time and trains specified. You may not start, break and resume, or end your journey at any intermediate station except to change to/from connecting trains as shown on the ticket(s) or other valid travel itinerary.",
                        "title": "VALIDITY"
                    },
                    {
                        "text": "Tickets must be purchased in advance of travel, subject to availability.",
                        "title": "BOOKING"
                    },
                    {
                        "text": "No refunds available.",
                        "title": "REFUNDS"
                    },
                    {
                        "text": "Yes - date/time of tickets can be changed up until time of departure subject to the payment up to GBP 10.00 fee per ticket per person and any difference in fares. If you change to a train on which a cheaper fare is available, the difference will not be refunded. Not possible to change the origin or destination.",
                        "title": "AMENDING YOUR BOOKING"
                    },
                    {
                        "text": "Child discounts, 16-25 Railcard, Family and Friends Railcard (standard class only), Senior Railcard, Two Together Railcard, HM Forces and Disabled Persons Railcards discounts apply.",
                        "title": "DISCOUNTS"
                    },
                    {
                        "text": "V2R",
                        "title": "CODE"
                    },
                    {
                        "text": "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.",
                        "title": "ACCESSIBILITY"
                    }
                ],
                "description": "Travel on specified train only",
                "full_amount": 43.5,
                "is_cheapest": true,
                "total_price": {
                    "amount": 43.5,
                    "currency": "GBP"
                },
                "alternatives": [
                    {
                        "journey_id": "785924f2-9819-4468-9ca7-eee4855546bd",
                        "total_price": {
                            "amount": 43.5,
                            "currency": "GBP"
                        },
                        "alternative_id": "6f3c35e3-7877-42a1-a1c9-72f338b722bc"
                    }
                ],
                "cancellation": null,
                "restrictions": [
                    "Avanti West Coast only"
                ],
                "difference_to_cheapest_in_class": {
                    "amount": 0,
                    "currency": "GBP"
                }
            },
            {
                "id": "mOL87jh9kuw=",
                "name": "Advance Single Standard Premium",
                "type": "NonFlexible",
                "refunds": "No refunds",
                "exchanges": null,
                "conditions": [
                    {
                        "text": "ADVANCE PREMIUM",
                        "title": "TICKET TYPE"
                    },
                    {
                        "text": "Non-refundable ticket, only valid for the date, time and trains specified. Gets standard premium seat.",
                        "title": "DESCRIPTION"
                    },
                    {
                        "text": "You must travel on the date, time and trains specified. You may not start, break and resume, or end your journey at any intermediate station except to change to/from connecting trains as shown on the ticket(s) or other valid travel itinerary.",
                        "title": "VALIDITY"
                    },
                    {
                        "text": "Can be booked up until the day before travel, subject to availability.",
                        "title": "BOOKING"
                    },
                    {
                        "text": "No refunds available.",
                        "title": "REFUNDS"
                    },
                    {
                        "text": "Yes - date/time of tickets can be changed up until time of departure (except if you have chosen to print your own tickets) subject to an administration fee of up to GBP 10.00 per ticket per person and any difference in fares. If you change to a train on which a cheaper fare is available, the difference will not be refunded. Not possible to change the origin or destination.",
                        "title": "AMENDING YOUR BOOKING"
                    },
                    {
                        "text": "Railcard discounts apply.",
                        "title": "DISCOUNTS"
                    },
                    {
                        "text": "5PR",
                        "title": "CODE"
                    },
                    {
                        "text": "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.",
                        "title": "ACCESSIBILITY"
                    }
                ],
                "description": "Travel on specified train only",
                "full_amount": 83,
                "is_cheapest": false,
                "total_price": {
                    "amount": 83,
                    "currency": "GBP"
                },
                "alternatives": [
                    {
                        "journey_id": "785924f2-9819-4468-9ca7-eee4855546bd",
                        "total_price": {
                            "amount": 83,
                            "currency": "GBP"
                        },
                        "alternative_id": "bc52bee0-f922-4e7e-8a82-8c7ae70ee95d"
                    }
                ],
                "cancellation": null,
                "restrictions": [
                    "Avanti West Coast Only"
                ],
                "difference_to_cheapest_in_class": {
                    "amount": 0,
                    "currency": "GBP"
                }
            },
            {
                "id": "vizLMDbxtvM=",
                "name": "Advance Single (1st Class)",
                "type": "NonFlexible",
                "refunds": "No refunds",
                "exchanges": null,
                "conditions": [
                    {
                        "text": "Non-refundable ticket, only valid for the date, time and trains specified.",
                        "title": "DESCRIPTION"
                    },
                    {
                        "text": "You must travel on the date, time and trains specified. You may not start, break and resume, or end your journey at any intermediate station except to change to/from connecting trains as shown on the ticket(s) or other valid travel itinerary.",
                        "title": "VALIDITY"
                    },
                    {
                        "text": "Must be booked in advance of travel, subject to availability.",
                        "title": "BOOKING"
                    },
                    {
                        "text": "No refunds available.",
                        "title": "REFUNDS"
                    },
                    {
                        "text": "Yes - date/time of tickets can be changed up until time of departure subject to the payment up to GBP 10.00 fee per ticket per person and any difference in fares. If you change to a train on which a cheaper fare is available, the difference will not be refunded. Not possible to change the origin or destination.",
                        "title": "AMENDING YOUR BOOKING"
                    },
                    {
                        "text": "Child discounts, 16-25 Railcard, Family and Friends Railcard (standard class only), Senior Railcard, Two Together Railcard, HM Forces and Disabled Persons Railcards discounts apply.",
                        "title": "DISCOUNTS"
                    },
                    {
                        "text": "V1U",
                        "title": "CODE"
                    },
                    {
                        "text": "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.",
                        "title": "ACCESSIBILITY"
                    }
                ],
                "description": "Travel on specified train only",
                "full_amount": 125,
                "is_cheapest": false,
                "total_price": {
                    "amount": 125,
                    "currency": "GBP"
                },
                "alternatives": [
                    {
                        "journey_id": "785924f2-9819-4468-9ca7-eee4855546bd",
                        "total_price": {
                            "amount": 125,
                            "currency": "GBP"
                        },
                        "alternative_id": "fc270a65-1f63-4bda-91dc-1d338c09751c"
                    }
                ],
                "cancellation": null,
                "restrictions": [
                    "Avanti West Coast Only"
                ],
                "difference_to_cheapest_in_class": {
                    "amount": 0,
                    "currency": "GBP"
                }
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "journeys_ticket_options"
    },
    "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 search id or the journey id is unknown or has expired. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": false,
        "endpoint_family": "journeys_ticket_options"
    },
    "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_ticket_options"
    },
    "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.