Browse documentation
GET

Ctrip URL to Hotel ID API

Turn a public Ctrip hotel URL into the numeric hotel_id used by the details, rooms, and reviews endpoints.

Endpoint

GET https://api.stayapi.com/v1/ctrip/hotel/extract-id

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

Parameters

Parameter Type Required Description
url string Required An http(s) hotel URL on ctrip.com, including desktop and supported mobile forms.

Request example

curl "https://api.stayapi.com/v1/ctrip/hotel/extract-id?url=https%3A%2F%2Fhotels.ctrip.com%2Fhotels%2F18078321.html" \
  -H "X-API-Key: YOUR_API_KEY"

Success response

{
  "success": true,
  "hotel_id": 18078321,
  "url": "https://hotels.ctrip.com/hotels/18078321.html"
}

Limits and errors

  • Resolution is local and does not make an upstream Ctrip request.
  • Non-Ctrip hosts and URLs without a numeric hotel ID return 400.
  • Errors are non-2xx RFC 7807 Problem Details responses with provider: "ctrip" and a correlation id.

Related Ctrip endpoints