Skip to content
Scrappa Get API key
Trip.com API 1 credit / request

Trip.com Train Price Calendar API Documentation

GET https://scrappa.co/api/tripcom/trains/calendar

Trip.com Train Price Calendar API Documentation Get the lowest train price for each departure window of about four hours, from a start date on. Each window has the date, the start time, the price as a number in the requested currency, whether the window has one train only (direct) and the train numbers. Use station codes from the Train Stations endpoint. The calendar reaches about 88 days ahead in Europe, Japan and Korea and about 14 days in China. A pair without trains returns an empty list and costs nothing. One way only. Cost: 1 credit per successful call. Failed calls cost 0.

Trip.com Train Price Calendar API Documentation 1 credit / request

Endpoint

Request preview
GET
https://scrappa.co/api/tripcom/trains/calendar
Auth header
x-api-key
Cost
1 credit / request
from = example to = example date = 2026-06-15
Response preview
200 OK
{
    "data": {
        "to": "FR3466",
        "from": "GB3467",
        "total": 1,
        "windows": [
            {
                "price": 54.2,
                "direct": true,
                "currency": "EUR",
                "train_numbers": [
                    "ES 9018"
                ],
                "departure_date": "2027-03-14",
...

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.

2 optional filters available.

from string Required

Departure station code from the Train Stations endpoint, e.g. GB3467.

Example value example
to string Required

Arrival station code in the same market, e.g. FR3466.

Example value example
date string Required

First day of the calendar, YYYY-MM-DD, today or later.

Example value 2026-06-15
currency string Optional

USD, EUR, GBP, JPY or KRW. Defaults to USD. Prices come back in this currency.

Example value USD
locale string Optional

Site language: en, en-gb, de, fr, ja, ko or zh-hk. Defaults to en.

Example value en-US

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": {
        "to": "FR3466",
        "from": "GB3467",
        "total": 1,
        "windows": [
            {
                "price": 54.2,
                "direct": true,
                "currency": "EUR",
                "train_numbers": [
                    "ES 9018"
                ],
                "departure_date": "2027-03-14",
                "departure_time": "08:00"
            }
        ],
        "currency": "EUR",
        "start_date": "2027-03-14",
        "lowest_price": 54.2
    },
    "meta": {
        "billable": true,
        "endpoint_family": "train_calendar"
    },
    "success": true
}

Errors

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

422

Validation Error

A query parameter is missing or invalid. This response is not billable.

{
    "errors": {
        "date": [
            "A departure date is required, formatted YYYY-MM-DD."
        ]
    },
    "message": "The request validation failed"
}
503

Unexpected Upstream Format

Trip.com answered with a format Scrappa does not know. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": true,
        "endpoint_family": "train_calendar"
    },
    "error": {
        "code": "PARSER_DRIFT",
        "message": "Trip.com answered with an unexpected format. Please retry later."
    },
    "success": false
}
503

Upstream Unavailable

Trip.com did not answer or no capacity was free. This response is not billable. Retry later.

{
    "meta": {
        "billable": false,
        "retryable": true,
        "endpoint_family": "train_calendar"
    },
    "error": {
        "code": "UPSTREAM_UNAVAILABLE",
        "message": "The Trip.com API 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.