
Trip.com API
Trains
/trains/details/byidTrip.com /trains/details/byid API
Need Trip.com /trains/details/byid data for your application? RealtyAPI's /trains/details/byid endpoint returns accurate, real-time information with a single HTTP request. There is no web scraping to manage, no proxy infrastructure to maintain, and no headless browsers eating your server resources — just clean, structured data delivered in milliseconds. The endpoint supports flexible query parameters so you can filter and shape the response to match your exact use case. If you need to enrich your database, populate a search index, or feed a machine learning pipeline, this endpoint gives you the raw material to build with confidence.
import requests
url = "https://trip.realtyapi.io/trains/details/byid"
headers = {
"x-realtyapi-key": "YOUR_API_KEY"
}
params = {
"origin": "Paris",
"destination": "London",
"trainNo": "9024"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data)What You Can Do With
the /trains/details/byid Endpoint.
Here's what this endpoint provides and how you can use the data it returns.
Endpoint Parameters
4 params| Parameter | Type | Required |
|---|---|---|
origin | STRING | Required |
destination | STRING | Required |
trainNo | STRING | Required |
date | STRING | Optional |
Required Parameters
This endpoint requires origin, destination, trainNo to fetch data. Pass these as query parameters in your request.
JSON Response
Receive structured JSON containing /trains/details/byid data from Trip.com. Parse it directly into your application models.
Real-Time Results
Every request fetches live Trip.com data. No stale caches — you always get the most current information available.
Error Handling
Clear HTTP status codes and error messages help you handle edge cases gracefully. See our documentation for the full error reference.