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

Trip.com Train Stations API Documentation

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

Trip.com Train Stations API Documentation Find train stations by name or list the hot stations of a country. Each station has a code, the name, the original name, a type, country, province, city code, coordinates, tags such as eurostar and child stations. The country filter is applied to the real country of each station. Use the codes with the Train Search and Train Price Calendar endpoints. China and Korea return few stations. A search without a match returns an empty list and costs nothing. Cost: 1 credit.

Trip.com Train Stations API Documentation 1 credit / request

Endpoint

Request preview
GET
https://scrappa.co/api/tripcom/trains/stations
Auth header
x-api-key
Cost
1 credit / request
Response preview
200 OK
{
    "data": {
        "mode": "search",
        "query": "London",
        "total": 1,
        "country": "GB",
        "stations": [
            {
                "code": "GB1601",
                "name": "London Euston",
                "tags": [],
                "type": 1,
                "city_id": "338",
                "latitude": 51.5283763,
...

Parameters

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

Runnable path

This endpoint has no required query parameters.

3 optional filters available.

mode string Optional

search or recommend. Defaults to search. recommend lists the hot stations of one country.

Example value example
query string Optional

Station or city name, 2 to 100 characters. Required for mode=search. Example: london.

Example value coffee shops
country string Optional

Two-letter country code, e.g. GB, FR, DE, IT, ES, JP. Results are filtered to this country. Required for mode=recommend.

Example value 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": {
        "mode": "search",
        "query": "London",
        "total": 1,
        "country": "GB",
        "stations": [
            {
                "code": "GB1601",
                "name": "London Euston",
                "tags": [],
                "type": 1,
                "city_id": "338",
                "latitude": 51.5283763,
                "city_code": "LON",
                "longitude": -0.1345585,
                "country_code": "GB",
                "country_name": "United Kingdom",
                "name_original": "London Euston",
                "province_name": "London",
                "flight_city_code": "LON",
                "children_stations": []
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "train_stations"
    },
    "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": {
        "query": [
            "A search text is required, e.g. london."
        ]
    },
    "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_stations"
    },
    "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 after one retry. This response is not billable. Retry later.

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