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

Trainline Return Fare Calendar API Documentation

GET https://scrappa.co/api/trainline/fares/calendar/return

Trainline Return Fare Calendar API Documentation Read the cheapest return leg fare for each pair of an outward day and a return day. inward_price is the price Trainline gives to the return leg inside a return ticket, it is not the total fare of the trip. A pair without a priced return leg is left out of the list, it is not a price of zero. It covers UK routes only: a continental route answers with 422 ROUTE_NOT_SUPPORTED, not billable. One request covers at most 14 outward days and 14 return days.

Trainline Return Fare Calendar API Documentation 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/trainline/fares/calendar/return
Auth header
x-api-key
Cost
1 credit/request
origin = example destination = example date_from = 2026-06-15
Response preview
200 OK
{
    "data": {
        "pairs": [
            {
                "return_date": "2026-11-08",
                "inward_price": {
                    "amount": 10.5,
                    "currency": "GBP"
                },
                "outward_date": "2026-11-02",
                "inward_departure": "2026-11-08T12:30:00+00:00"
            },
            {
                "return_date": "2026-11-09",
...

Parameters

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

Runnable path

6 required parameters needed before sending a request.

1 optional filter 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_from string Required

First outward day, YYYY-MM-DD, today or later.

Example value 2026-06-15
date_to string Required

Last outward day, YYYY-MM-DD, at most 14 days in total and inside the fare horizon of about 178 days.

Example value 2026-06-15
return_from string Required

First return day, YYYY-MM-DD, not before the first outward day.

Example value example
return_to string Required

Last return day, YYYY-MM-DD, at most 14 days in total and inside the fare horizon of about 178 days.

Example value example
currency string Optional

GBP or EUR. Defaults to GBP.

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": {
        "pairs": [
            {
                "return_date": "2026-11-08",
                "inward_price": {
                    "amount": 10.5,
                    "currency": "GBP"
                },
                "outward_date": "2026-11-02",
                "inward_departure": "2026-11-08T12:30:00+00:00"
            },
            {
                "return_date": "2026-11-09",
                "inward_price": {
                    "amount": 13.9,
                    "currency": "GBP"
                },
                "outward_date": "2026-11-03",
                "inward_departure": "2026-11-09T14:30:00+00:00"
            }
        ],
        "origin": "urn:trainline:generic:loc:EUS1444gb",
        "date_to": "2026-11-03",
        "currency": "GBP",
        "date_from": "2026-11-02",
        "return_to": "2026-11-10",
        "destination": "urn:trainline:generic:loc:MAN2968gb",
        "return_from": "2026-11-08"
    },
    "meta": {
        "billable": true,
        "endpoint_family": "fares_calendar_return"
    },
    "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"
}
422

Route Not Supported

Trainline has no return fare calendar for this route. Only UK routes have one. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": false,
        "endpoint_family": "fares_calendar_return"
    },
    "error": {
        "code": "ROUTE_NOT_SUPPORTED",
        "message": "Trainline has no return fare calendar for this route. It covers UK routes only; use the fare calendar for single fares."
    },
    "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": "fares_calendar_return"
    },
    "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.