GET
Ctrip Destination Lookup API
Find the city_id used by Ctrip hotel search from a city or resort name and optional country.
Copy for your AI agent
Paste into Claude, ChatGPT, Cursor or Copilot — endpoint, parameters, response fields and a curl example in Markdown.
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.