Trip APIhk.trip.com ↗
Search flights and hotels on hk.trip.com, fetch guest reviews, and get trending destinations via 4 structured API endpoints returning live pricing and ratings.
What is the Trip API?
The hk.trip.com API exposes 4 endpoints covering flight search, hotel search, hotel reviews, and trending destinations from Hong Kong's Trip.com travel marketplace. The search_flights endpoint returns full itinerary lists with per-flight pricing, airline data, and segment details, while search_hotels delivers hotel listings with ratings, room info, and location data — all in structured JSON ready to query programmatically.
curl -X POST 'https://api.parse.bot/scraper/9bcbfcea-6ec6-48ea-91e3-b149077443a0/search_flights' \
-H 'X-API-Key: $PARSE_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"origin": "HKG",
"trip_type": "1",
"depart_date": "2026-08-10",
"destination": "NRT",
"return_date": "2026-08-17"
}'Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace hk-trip-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
from parse_apis.trip.com_hk_api import TripHK, TripType, FlightItinerary, Hotel, Review, DestinationGroup
client = TripHK()
# Discover destinations to find city IDs for hotel search
for group in client.destinationgroups.list():
print(group.group_name, group.group_id)
for dest in group.hot_destination:
print(dest.display_name, dest.id)
# Search flights from Hong Kong to Tokyo (one-way)
for flight in client.flightitineraries.search(
origin="HKG",
destination="NRT",
depart_date="2026-08-01",
trip_type=TripType.ONE_WAY,
):
print(flight.airline, flight.price)
for seg in flight.segments:
print(seg.flight_no, seg.depart_date_time, seg.arrive_date_time, seg.duration)
# Search hotels in Hong Kong (city_id=58) and browse reviews
for hotel in client.hotels.search(city_id="58", checkin="2026-08-01", checkout="2026-08-03"):
print(hotel.hotel_basic_info.hotel_name, hotel.hotel_basic_info.price)
print(hotel.comment_info.comment_score, hotel.position_info.city_name)
# Access reviews as a sub-resource of the hotel
for review in hotel.reviews.list(limit=3):
print(review.id, review.rating, review.create_date, review.content)
Search for flights between two cities. Returns flight itineraries with pricing, segments, and airline information. Supports one-way and round-trip searches. Results include lowest price, currency, and detailed segment info including departure/arrival times, airports, and durations.
| Param | Type | Description |
|---|---|---|
| originrequired | string | Origin airport or city code (e.g., HKG, NYC, PEK) |
| trip_type | string | Trip type: 1 for one-way, 2 for round-trip |
| depart_daterequired | string | Departure date in YYYY-MM-DD format |
| destinationrequired | string | Destination airport or city code (e.g., NRT, TYO, HKG) |
| return_date | string | Return date in YYYY-MM-DD format, required when trip_type is 2 (round-trip) |
{
"type": "object",
"fields": {
"currency": "string, currency code (e.g., HKD)",
"lowestPrice": "number, lowest total price found",
"recordCount": "integer, total number of flights found",
"flightItineraryList": "array of flight itinerary objects with airline, price, segments, and flags"
},
"sample": {
"data": {
"currency": "HKD",
"lowestPrice": 1743,
"recordCount": 2,
"flightItineraryList": [
{
"flags": [
"FASTEST"
],
"price": 1743,
"airline": "UO",
"segments": [
{
"duration": 205,
"flightNo": "UO604",
"airlineCode": "UO",
"arriveDateTime": "2026-07-01 07:00:00",
"departDateTime": "2026-07-01 02:35:00"
}
]
}
]
},
"status": "success"
}
}About the Trip API
Flight and Hotel Search
The search_flights endpoint accepts an origin and destination (IATA airport or city codes), a depart_date, and an optional trip_type (1 for one-way, 2 for round-trip). Responses include a flightItineraryList array with per-itinerary airline identifiers, segment breakdowns, pricing, and flags — plus a top-level lowestPrice and recordCount so you can surface the cheapest option without iterating the full list. For round-trip searches, pass a return_date alongside trip_type: 2.
The search_hotels endpoint takes a city_id, checkin, and checkout date pair, and an optional adults count. Each hotel object in the returned hotelList contains four sub-objects: hotelBasicInfo (name, star rating, thumbnail), commentInfo (aggregate score), positionInfo (address and coordinates), and roomInfo (rate and room-type snapshot). City IDs follow Trip.com's internal scheme — use get_hot_destinations to resolve readable city names to their numeric IDs before querying.
Reviews and Destination Discovery
get_hotel_reviews returns paginated guest reviews for a specific hotel identified by hotel_id. Each entry in commentList carries a content string, numeric rating, createDate, userInfo, and an imageList of attached photos. The totalCount field tells you how many pages to expect when paginating with the page parameter.
get_hot_destinations requires no inputs and returns destination groups, each containing a hotDestination list of city names and their corresponding IDs. This endpoint is the practical starting point when building city-aware hotel search flows — map names to IDs here, then pass them to search_hotels.
The Trip API is a managed, monitored endpoint for hk.trip.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when hk.trip.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official hk.trip.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a flight price tracker comparing round-trip fares between HKG and multiple destinations using
lowestPricefromsearch_flights. - Aggregate hotel ratings and review counts across a city by combining
commentInfofromsearch_hotelswith paginatedcommentListfromget_hotel_reviews. - Populate a destination picker UI with city names and IDs from
get_hot_destinationsto drive hotel search queries. - Analyze guest review sentiment by ingesting
contentandratingfields fromget_hotel_reviewsacross multiple properties. - Display cheapest available hotel room rates for a city break by querying
roomInfoinsearch_hotelsfor a givencheckin/checkoutwindow. - Filter one-way versus round-trip flight availability using the
trip_typeparameter insearch_flightsfor the same city pair.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Trip.com offer an official developer API?+
What does `search_flights` return beyond price — can I get baggage or fare-class details?+
flightItineraryList includes airline identifiers, flight segments, total pricing, and per-itinerary flags. Baggage allowance details and fare-class breakdowns are not currently exposed in the response shape. You can fork this API on Parse and revise it to add an endpoint targeting those details.Does the API cover train or bus searches available on hk.trip.com?+
How does pagination work for hotel reviews?+
page parameter to get_hotel_reviews alongside the required hotel_id. The response includes a totalCount field indicating the total number of reviews, which you can use to calculate how many pages exist before iterating.How do I find the correct `city_id` for a hotel search?+
get_hot_destinations with no parameters. It returns grouped destination lists, each entry containing a city name and its numeric ID. Pass that ID as city_id to search_hotels. The endpoint documents example IDs — 228 for Tokyo, 58 for Hong Kong, 30 for Shenzhen — as reference points.