GET
# Ctrip Destination Lookup API

Find the city\_id used by Ctrip hotel search from a city or resort name and optional country.

## Overview

### Endpoint URL

GET https://api.stayapi.com/v1/ctrip/destinations/lookup 

Authenticate with your StayAPI key in the `X-API-Key` header.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| query | string | Required | City or resort name in English or Chinese, 2–100 characters. Whitespace is trimmed. |
| country | string | Optional | Exact English or provider-localized country name, 2–100 characters. Case-insensitive; ISO codes and guessed aliases are not supported. |
| limit | integer | Optional | Suggestions to return, 1–15. Default 10. Does not suppress ambiguity checks. |

## Limits and errors

- Names, province and country labels may be localized or null. country\_en is the provider-supplied English country name or null, returned on the selected city and each city suggestion. A successful city\_id is a city identifier, not a hotel or region identifier.
- resolution is city for a direct city match or parent\_city for an exact place mapped to its containing Ctrip hotel-search city. matched\_place\_name, matched\_place\_type and nullable matched\_place\_id identify that place; all three are null for a direct city match. These fields appear on the selected result and each city suggestion. name and city\_id always describe the returned search city, which need not be a legal municipality. For example, Magaluf maps to Calvia (51423).
- Supply country to help resolve a place within the intended country. A parent\_city result still requires an exact place-name match after case, accent, punctuation and spacing normalization, plus an explicit matching country; a similar hotel name or a place in another country is not a substitute.
- A matching native city, including a supported localized city alias, takes precedence over a containing-city place match and a same-name province. For example, Sevilla resolves directly to Seville (1350) with resolution=city; a parent\_city result is used only when no native city matches. Province errors carry region\_type=province, destination\_id and a null city\_id. A place with conflicting parent cities returns 409; hotel-only or unmatched names return 404.
- HTTP 409 DESTINATION\_AMBIGUOUS means several cities match. Inspect suggestions and candidate\_count; reducing limit to 1 does not force a match. Add country or select a verified city\_id. If the short name Castellón is ambiguous, use the full city name Castellón de la Plana; supported aliases do not guarantee that every short name is unique.
- HTTP 422 DESTINATION\_NOT\_CITY identifies a province, region or island. The destination object includes region metadata and city\_suggestions; suggestions contains typed city children when available. Do not use a region ID as city\_id.
- For example, Murcia with country=Spain can return 422 with the municipality city\_id 3496 among city\_suggestions; inspect the typed child rather than assuming the province is a city.
- HTTP 404 DESTINATION\_NOT\_FOUND means no city matched. Invalid inputs return 400/422; upstream failures return 502 or 503. Errors are never successful empty city resolutions. HTTP 503 LOOKUP\_CAPACITY\_EXCEEDED includes Retry-After; wait that interval before retrying. Per-user rate limits still return 429.
- Errors are non-2xx RFC 7807 Problem Details responses with `provider: "ctrip"` and a correlation id.

## Related Ctrip endpoints

[Hotel search Pass the selected city\_id to find hotels.](/docs/endpoints/ctrip/hotel-search)[URL to Hotel ID Resolve an existing property URL instead of a destination.](/docs/endpoints/ctrip/extract-id)

Request

```curl
curl 'https://api.stayapi.com/v1/ctrip/destinations/lookup?query=Hangzhou&country=China&limit=10' -H 'X-API-Key: YOUR_API_KEY'
```

Response

```json
{
  "success": true,
  "query": "Hangzhou",
  "resolution": "city",
  "matched_place_name": null,
  "matched_place_type": null,
  "matched_place_id": null,
  "city_id": 17,
  "name": "杭州",
  "name_en": "Hangzhou",
  "country": "中国",
  "country_en": "China",
  "suggestions": [{
    "resolution": "city",
    "matched_place_name": null,
    "matched_place_type": null,
    "matched_place_id": null,
    "city_id": 17,
    "name": "杭州",
    "name_en": "Hangzhou",
    "display_name": "杭州, 浙江, 中国",
    "province": "浙江",
    "country": "中国",
    "country_en": "China",
    "type": "domestic_city",
    "search_url": "https://hotels.ctrip.com/hotels/list?cityId=17"
  }],
  "returned": 1
}
```

```json
{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "Invalid request parameters",
  "instance": "/v1/ctrip/destinations/lookup",
  "provider": "ctrip",
  "correlation_id": "example-correlation-id"
}
```
