Trip.com API endpoint
Returns Trip.com's own top-hotels page for a city: hotel summaries (name, location, star rating, guest rating, review count, image, display price) for the hotels Trip.com features on that city's hotel-list page. Trip.com does not expose a free-text city search, so callers supply the exact city_slug and city_id pair from a known Trip.com hotel-list URL of the form https://www.trip.com/hotels/{city_slug}-hotels-list-{city_id}/.
/tripcom/hotels/searchQuery parameters:
city_slug (required) — Trip.com city slug, the text segment of a /hotels/{city_slug}-hotels-list-{city_id}/ URL, e.g. bangkok. Matched case-insensitively.city_id (required) — Trip.com numeric city id, the trailing number of a
/hotels/{city_slug}-hotels-list-{city_id}/ URL, e.g. 359 for Bangkok.Notable response behavior:
city_slug and city_id must be exactly correct — Trip.com's own
page 404s on a mismatched slug even when the id is valid, and this
endpoint surfaces that as a 404.hotels is Trip.com's own curated top-hotels page for the city, not a fully paginated search — Trip.com does not expose page/offset parameters on this page. count reports exactly how many hotels this page returned, not a citywide total.price is the list page's display price for the shown stay
length (usually one night), not a full rate breakdown.hotel_id in each result is the numeric Trip.com hotel id to pass to the
hotel-detail endpoint.| Field | Filled in, of 9 checked | Values in the sample |
|---|---|---|
| hotel_id | 9 | |
| name | 9 | “NASA BANGKOK - Airport Rail Link Ramkhamhang ★★★★” and 8 other values |
| url | 9 | trip.com |
| image_url | 9 | ak-d.tripcdn.com |
| location | 9 | “44 Sukhumvit 71 Rd, Suan Luang, Bangkok” and 8 other values |
| star_rating | 9 | 3 to 5, median 4 |
| rating_score | 9 | 8 to 9.9, median 8.6 |
| review_count | 9 | 13 to 16,689, median 1,685 |
| description | 8 | median 279 characters |
| price | 9 |
| Parameter | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
| city_slug | string | Yes | Trip.com city slug, the text segment of a /hotels/{city_slug}-hotels-list-{city_id}/ URL | bangkok | |
| city_id | string | Yes | Trip.com numeric city id, the trailing number of a /hotels/{city_slug}-hotels-list-{city_id}/ URL | 359 | |
| x-api-key (header) | string | Yes | API key required |
curl -X GET "https://api.crawlora.net/api/v1/tripcom/hotels/search?city_slug=bangkok&city_id=359" \ -H "x-api-key: $CRAWLORA_API_KEY"
{
"code": 200,
"msg": "OK",
"data": {
"city_slug": "bangkok",
"city_id": "359",
"count": 9,
"hotels": [
{
"hotel_id": 39371462,
"name": "Divalux Resort and Spa Bangkok, Suvarnabhumi Airport-Free Shuttle",
"url": "https://www.trip.com/hotels/bang-sao-thong-district-hotel-detail-39371462/divalux-resort-and-spa-bangkok-suvarnabhumi-airport-free-shuttle/",
"image_url": "https://ak-d.tripcdn.com/images/0585b12000sq6ih4c6345.jpg",
"location": "88 Moo3, Sriwaree Road, Sisa Chokhe Noi, Bang Sao Thong District, Srisa Chorakhe Noi, Bang Sao Thong",
"star_rating": 5,
"rating_score": 8.7,
"review_count": 872,
"description": "The hotel has a relaxing wellness atmosphere, and the staff are friendly and provide excellent service.",
"price": {
"raw": "US$38",
"currency": "US$",
"amount": 38,
"unit": "1 night"
}
}
],
"source_url": "https://www.trip.com/hotels/bangkok-hotels-list-359/"
}
}Request schema
No body schema
Response schema
#/definitions/tripcom.searchResponseDoc
| Field | Type | Required | Enum | Bounds | Example | Description |
|---|---|---|---|---|---|---|
| code | integer | No | 200 | |||
| data | tripcom.SearchResponse | No | ||||
| data.city_id | string | No | 359 | |||
| data.city_slug | string | No | bangkok | |||
| data.count | integer | No | 9 | |||
| data.hotels | array | No | ||||
| data.hotels[].description | string | No | The hotel has a relaxing wellness atmosphere... | |||
| data.hotels[].hotel_id | integer | No | 39371462 | |||
| data.hotels[].image_url | string | No | https://ak-d.tripcdn.com/images/0585b12000sq6ih4c6345.jpg | |||
| data.hotels[].location | string | No | 88 Moo3, Sriwaree Road, Sisa Chokhe Noi, Bang Sao Thong District, Srisa Chorakhe Noi, Bang Sao Thong | |||
| data.hotels[].name | string | No | Divalux Resort and Spa Bangkok, Suvarnabhumi Airport-Free Shuttle | |||
| data.hotels[].price | tripcom.Price | No | ||||
| data.hotels[].price.amount | number | No | 38 | |||
| data.hotels[].price.currency | string | No | US$ | |||
| data.hotels[].price.raw | string | No | US$38 | |||
| data.hotels[].price.unit | string | No | 1 night | |||
| data.hotels[].rating_score | number | No | 8.7 | |||
| data.hotels[].review_count | integer | No | 872 | |||
| data.hotels[].star_rating | integer | No | 5 | |||
| data.hotels[].url | string | No | https://www.trip.com/hotels/bang-sao-thong-district-hotel-detail-39371462/divalux-resort-and-spa-bangkok-suvarnabhumi-airport-free-shuttle/ | |||
| data.source_url | string | No | https://www.trip.com/hotels/bangkok-hotels-list-359/ | |||
| msg | string | No | OK |
| Status | Description | Schema |
|---|---|---|
| 400 | Bad Request | #/definitions/app.Response |
| 404 | Not Found | #/definitions/app.Response |
| 500 | Internal Server Error | #/definitions/app.Response |
| 503 | Service Unavailable | #/definitions/app.Response |
Use environment variables for secrets and keep Crawlora API keys server-side.
curl -X GET "https://api.crawlora.net/api/v1/tripcom/hotels/search?city_slug=bangkok&city_id=359" \
-H "x-api-key: $CRAWLORA_API_KEY"