# Trip.com Suggest API Documentation

<p><strong>Trip.com Suggest API Documentation</strong> 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.</p>

- **Documentation:** [https://scrappa.co/docs/tripcom-api/tripcom_suggest](https://scrappa.co/docs/tripcom-api/tripcom_suggest)
- **API group:** Trip.com API
- **Endpoint:** `GET https://scrappa.co/api/tripcom/suggest`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Name to search, 2 to 100 characters. Example: paris. |
| `type` | string | No | all, city, hotel or airport. Defaults to all. |
| `locale` | string | No | Site language: en, en-gb, de, fr, ja, ko or zh-hk. Defaults to en. |

## Example response

```json
{
    "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

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing or invalid. This response is not billable. |
| 404 | Resource Not Found | The id is unknown. This response is not billable. |
| 502 | Unexpected Upstream Answer | Trip.com answered with a page or payload Scrappa cannot read. This response is not billable. Retry later. |
| 503 | Upstream Unavailable | Trip.com did not answer after one retry. This response is not billable. Retry later. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
