Skip to content
Scrappa Get API key
Trip.com API 1 credit / request

Trip.com Suggest API Documentation

GET https://scrappa.co/api/tripcom/suggest

Trip.com Suggest API Documentation Find cities, hotels and airports by name. Each row has a type (city, hotel or airport), the name, the region and the ids the other endpoints accept unchanged: city_id for hotel search, hotel_id for hotel detail and reviews, airport_code and city_code for flight search. Use type to ask for one kind only. The three lookups of type=all count as one request and cost 1 credit. A search without any match returns an empty list and costs nothing.

Trip.com Suggest API Documentation 1 credit / request

Endpoint

Request preview
GET
https://scrappa.co/api/tripcom/suggest
Auth header
x-api-key
Cost
1 credit / request
query = coffee shops
Response preview
200 OK
{
    "data": {
        "type": "all",
        "query": "paris",
        "total": 3,
        "locale": "en",
        "results": [
            {
                "name": "Paris",
                "type": "city",
                "region": "Ile-de-France, France",
                "city_id": "192",
                "hotel_id": null,
                "latitude": null,
...

Parameters

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

Runnable path

1 required parameter needed before sending a request.

2 optional filters available.

query string Required

Name to search, 2 to 100 characters. Example: paris.

Example value coffee shops
type string Optional

all, city, hotel or airport. Defaults to all.

Example value example
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": {
        "type": "all",
        "query": "paris",
        "total": 3,
        "locale": "en",
        "results": [
            {
                "name": "Paris",
                "type": "city",
                "region": "Ile-de-France, France",
                "city_id": "192",
                "hotel_id": null,
                "latitude": null,
                "city_code": null,
                "longitude": null,
                "airport_code": null
            },
            {
                "name": "Hotel R\u00e9gence Etoile",
                "type": "hotel",
                "region": "Paris, Ile-de-France, France",
                "city_id": "192",
                "hotel_id": "718146",
                "latitude": 48.876537,
                "city_code": null,
                "longitude": 2.292983,
                "airport_code": null
            },
            {
                "name": "Heathrow Airport",
                "type": "airport",
                "region": "London, United Kingdom",
                "city_id": "338",
                "hotel_id": null,
                "latitude": 51.5075,
                "city_code": "LON",
                "longitude": -0.128056,
                "airport_code": "LHR"
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "suggest"
    },
    "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": {
        "query": [
            "A search text is required, e.g. 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.