Skip to content
Scrappa Get API key
Trip.com API 1-18 credits / request

Trip.com Hotel Search API Documentation

GET https://scrappa.co/api/tripcom/hotels/search

Trip.com Hotel Search API Documentation List the hotels of a city for a stay. Each hotel has the id, name, stars, guest score, review count, address, coordinates, price per night, original price, total price for the stay, currency, free cancellation, the room of the cheapest offer, images and an advertisement flag. Page 1 is the list page of the site. Set page to 2 or higher for the next hotels (up to page 400). Set pages (2 to 6) to read several pages in one call, starting at page 2 or higher. Rows from page 2 on have price_basis per_night_excl_taxes_and_fees: the price per night before taxes and fees. Page 1 rows have no price_basis. Do not compare prices of page 1 with prices of later pages. total_price on page 2 and later is the stay total with taxes and fees, and only when the site shows it for the stay you asked for and the amount fits the nightly price. Otherwise it is null (never the nightly price). Page 1 always has the stay total when the site shows it. free_cancellation is true or null from page 2 on: null means the site did not say. Hotels of page 1 are not repeated on page 2 and later. An ad that repeats is returned once. Filters: stars, min_price, max_price, guest_score_min (6 to 9), free_cancellation, breakfast and sort (popularity, price_asc, price_desc, top_reviewed, stars, distance). A search with guest_score_min, free_cancellation, breakfast or a sort other than popularity and price_asc is served by the paged list from page 1 on. Price sorts put the rows of one answer in exact price order. Across pages the order follows Trip.com and can overlap a little. Rows that break a filter are never returned. Use the filters endpoint for the labels. Only one room is supported. Room rate plans are not available. Cost: page 1 is 1 credit. Each page from the paged list is 3 credits, so pages=5 is 15 credits. Failed requests, empty pages and the end of the list are not billed.

Trip.com Hotel Search API Documentation 1-18 credits / request

Endpoint

Request preview
GET
https://scrappa.co/api/tripcom/hotels/search
Auth header
x-api-key
Cost
1-18 credits / request
city_id = 1234567890 check_in = example check_out = example
Response preview
200 OK
{
    "data": {
        "page": 1,
        "sort": "popularity",
        "count": 4,
        "total": 6503,
        "adults": 2,
        "hotels": [
            {
                "bed": "1 queen bed",
                "url": "https://www.trip.com/hotels/detail/?hotelId=718146",
                "city": "Paris",
                "name": "Hotel R\u00e9gence Etoile",
                "zone": "Champs Elys\u00e9es",
...

Parameters

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

Runnable path

3 required parameters needed before sending a request.

13 optional filters available.

city_id string Required

Trip.com city id from the suggest endpoint. Example: 192 for Paris.

Example value 1234567890
check_in string Required

Check-in date, YYYY-MM-DD, today or later. Example: 2027-03-14.

Example value example
check_out string Required

Check-out date, YYYY-MM-DD, after check-in, at most 30 nights. Example: 2027-03-16.

Example value example
adults integer Optional

Number of adults, 1 to 9. Defaults to 2.

Example value 10
children_ages string Optional

Comma separated ages of the children, 0 to 17, at most 4. Example: 5,9.

Example value example
stars string Optional

Comma separated star classes, 1 to 5. Only hotels of these classes are returned. Example: 4,5.

Example value example
min_price integer Optional

Minimum price per night in the chosen currency. Whole number.

Example value 10
max_price integer Optional

Maximum price per night in the chosen currency. Whole number.

Example value 10
page integer Optional

Page number, 1 to 400. Page 1 is the list page. Page 2 and later come from the paged list. Defaults to 1.

Example value 1
pages integer Optional

Pages to read in one call, 1 to 6. Needs page 2 or higher, or one of the paged list options. Costs 3 credits per page read. Defaults to 1.

Example value 10
guest_score_min integer Optional

Minimum guest score: 6, 7, 8 or 9. Only hotels with this score or higher are returned.

Example value 10
free_cancellation boolean Optional

Set to 1 to get hotels with free cancellation only.

Example value true
breakfast boolean Optional

Set to 1 to get hotels with an offer that includes breakfast only.

Example value true
sort string Optional

popularity (default), price_asc, price_desc, top_reviewed, stars or distance. price_desc, top_reviewed, stars and distance are served by the paged list.

Example value relevance
currency string Optional

Price currency: USD, EUR, GBP, JPY or KRW. Defaults to USD. Every price in the answer has this currency.

Example value USD
locale string Optional

Site language: en, en-gb, de, fr, ja, ko or zh-hk. Defaults to en.

Example value en-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": {
        "page": 1,
        "sort": "popularity",
        "count": 4,
        "total": 6503,
        "adults": 2,
        "hotels": [
            {
                "bed": "1 queen bed",
                "url": "https://www.trip.com/hotels/detail/?hotelId=718146",
                "city": "Paris",
                "name": "Hotel R\u00e9gence Etoile",
                "zone": "Champs Elys\u00e9es",
                "is_ad": false,
                "stars": 4,
                "images": [
                    "https://ak-d.tripcdn.com/images/0582t12000jbiuxe0A6C0_R_600_600_R5_D.jpg_.webp",
                    "https://ak-d.tripcdn.com/images/200v11000000rkn07BFC6_R_600_600_R5_D.jpg_.webp"
                ],
                "nights": 2,
                "address": "Champs Elys\u00e9es",
                "city_id": "192",
                "name_en": "Hotel R\u00e9gence Etoile",
                "category": "Hotel",
                "currency": "USD",
                "hotel_id": "718146",
                "latitude": 48.876537,
                "position": 1,
                "longitude": 2.292983,
                "room_name": "Classic Room",
                "guest_score": 9.2,
                "total_price": 547.96,
                "review_count": 562,
                "location_hint": "Near Arc de Triomphe de l\u2019Etoile | Charles de Gaulle - \u00e9toile Metro Station",
                "price_per_night": 232,
                "free_cancellation": true,
                "guest_score_label": "Great",
                "original_price_per_night": 357
            },
            {
                "bed": "1 double bed or 2 single beds",
                "url": "https://www.trip.com/hotels/detail/?hotelId=717490",
                "city": "Paris",
                "name": "Hotel de l'Aqueduc",
                "zone": "Near Paris North Station|Le Marais",
                "is_ad": false,
                "stars": 3,
                "images": [
                    "https://ak-d.tripcdn.com/images/1mc1p12000rpkwjys2F52_R_600_600_R5_D.jpg_.webp",
                    "https://ak-d.tripcdn.com/images/0586h12000sn61efqEF75_R_600_600_R5_D.jpg_.webp"
                ],
                "nights": 2,
                "address": null,
                "city_id": "192",
                "name_en": "Hotel de l'Aqueduc",
                "category": "Hotel",
                "currency": "USD",
                "hotel_id": "717490",
                "latitude": 48.881377,
                "position": 2,
                "longitude": 2.362014,
                "room_name": "Classic Room",
                "guest_score": 8.1,
                "total_price": 214.04,
                "review_count": 388,
                "location_hint": "Near Paris North Station | Le Marais",
                "price_per_night": 86,
                "free_cancellation": false,
                "guest_score_label": "Very good",
                "original_price_per_night": 147
            }
        ],
        "locale": "en",
        "city_id": "192",
        "check_in": "2027-03-14",
        "currency": "USD",
        "check_out": "2027-03-16"
    },
    "meta": {
        "billable": true,
        "endpoint_family": "hotel_search"
    },
    "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": {
        "pages": [
            "Several pages in one call start at page 2: page 1 is a separate list. Set page to 2 or higher."
        ],
        "city_id": [
            "A city id is required. Take it from the suggest endpoint, e.g. 192 for Paris."
        ]
    },
    "message": "The request validation failed"
}
404

Resource Not Found

The id is unknown. This response is not billable.

{
    "meta": {
        "billable": false,
        "retryable": false,
        "endpoint_family": "trip_com"
    },
    "error": {
        "code": "NOT_FOUND",
        "message": "The requested Trip.com resource was not found."
    },
    "success": false
}
502

Unexpected Upstream Answer

Trip.com answered with a page or payload Scrappa cannot read. This response is not billable. Retry later.

{
    "meta": {
        "billable": false,
        "retryable": true,
        "endpoint_family": "trip_com"
    },
    "error": {
        "code": "PARSER_DRIFT",
        "message": "The Trip.com API is temporarily unavailable. Please retry."
    },
    "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": "trip_com"
    },
    "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.