# Trip.com Train Search API Documentation

<p><strong>Trip.com Train Search API Documentation</strong> Search dated train journeys between two stations. Each journey has an id, local departure and arrival times in ISO 8601, duration, changes, train numbers, both stations and the cheapest fare as a number in the requested currency, with the booking fee and tickets left. Use station codes from the Train Stations endpoint. Both stations must be in one market: Europe, Japan, Korea or China. Europe, Japan and Korea sell about 88 days ahead, China about 14. A pair or date without trains returns an empty list and costs nothing. One way only. The first page of results is returned. Cost: 3 credits per successful call. Failed calls cost 0.</p>

- **Documentation:** [https://scrappa.co/docs/tripcom-api/tripcom_trains_search](https://scrappa.co/docs/tripcom-api/tripcom_trains_search)
- **API group:** Trip.com API
- **Endpoint:** `GET https://scrappa.co/api/tripcom/trains/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | Yes | Departure station code from the Train Stations endpoint, e.g. GB3467. |
| `to` | string | Yes | Arrival station code in the same market, e.g. FR3466. |
| `date` | string | Yes | Departure date, YYYY-MM-DD, today or later. |
| `adults` | integer | No | Number of adults, 1 to 9. Defaults to 1. |
| `currency` | string | No | USD, EUR, GBP, JPY or KRW. Defaults to USD. Prices come back in this currency. |
| `locale` | string | No | Site language: en, en-gb, de, fr, ja, ko or zh-hk. Defaults to en. |

## Example response

```json
{
    "data": {
        "to": "FR3466",
        "date": "2027-03-14",
        "from": "GB3467",
        "total": 1,
        "adults": 1,
        "locale": "en",
        "trains": [
            {
                "id": "s2@AItl...",
                "tags": [
                    "allowed_e_ticket",
                    "cheapest"
                ],
                "direct": true,
                "changes": 0,
                "duration": "3h 20m",
                "operator": null,
                "available": true,
                "arrival_time": "2027-03-14T13:51:00",
                "cheapest_fare": {
                    "price": 304.83,
                    "currency": "USD",
                    "booking_fee": 0,
                    "tickets_left": 172,
                    "original_price": 304.83
                },
                "train_numbers": [
                    "ES 9018"
                ],
                "departure_time": "2027-03-14T10:31:00",
                "arrival_station": {
                    "code": "FR3466",
                    "name": "Paris Gare du Nord",
                    "latitude": 48.88099883257269,
                    "city_code": "PAR",
                    "longitude": 2.356107777136769,
                    "country_code": "FR"
                },
                "duration_minutes": 200,
                "departure_station": {
                    "code": "GB3467",
                    "name": "London St. Pancras International",
                    "latitude": 51.5306243,
                    "city_code": "LON",
                    "longitude": -0.1255274,
                    "country_code": "GB"
                },
                "operator_logo_url": "https://example.com/logo.png"
            }
        ],
        "currency": "USD"
    },
    "meta": {
        "credits": 3,
        "billable": true,
        "endpoint_family": "train_search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing or invalid. This response is not billable. |
| 503 | Unexpected Upstream Format | Trip.com answered with a format Scrappa does not know. This response is not billable. |
| 503 | Upstream Unavailable | Trip.com did not answer or no capacity was free. This response is not billable. Retry later. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
