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

Trainline Fare Calendar API Documentation

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

Trainline Fare Calendar API Documentation Read the cheapest one-way fare for each day between two stations. A day without a fare is left out of the list, it is not a price of zero.

Trainline Fare Calendar API Documentation 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/trainline/fares/calendar
Auth header
x-api-key
Cost
1 credit/request
origin = example destination = example date_from = 2026-06-15
Response preview
200 OK
{
    "data": {
        "days": [
            {
                "date": "2026-10-27",
                "price": {
                    "amount": 14,
                    "currency": "GBP"
                }
            },
            {
                "date": "2026-10-28",
                "price": {
                    "amount": 23.9,
...

Parameters

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

Runnable path

4 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 day, YYYY-MM-DD, today or later.

Example value 2026-06-15
date_to string Required

Last day, YYYY-MM-DD, at most 60 days after the first day and inside the fare horizon of about 178 days.

Example value 2026-06-15
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": {
        "days": [
            {
                "date": "2026-10-27",
                "price": {
                    "amount": 14,
                    "currency": "GBP"
                }
            },
            {
                "date": "2026-10-28",
                "price": {
                    "amount": 23.9,
                    "currency": "GBP"
                }
            },
            {
                "date": "2026-10-29",
                "price": {
                    "amount": 23.3,
                    "currency": "GBP"
                }
            },
            {
                "date": "2026-10-30",
                "price": {
                    "amount": 23.3,
                    "currency": "GBP"
                }
            },
            {
                "date": "2026-10-31",
                "price": {
                    "amount": 22.4,
                    "currency": "GBP"
                }
            }
        ],
        "origin": "urn:trainline:generic:loc:EUS1444gb",
        "date_to": "2026-11-03",
        "currency": "GBP",
        "date_from": "2026-10-27",
        "destination": "urn:trainline:generic:loc:MAN2968gb"
    },
    "meta": {
        "billable": true,
        "endpoint_family": "fares_calendar"
    },
    "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"
}
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"
    },
    "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.