GET

URL to Hotel ID

Convert Booking.com hotel URLs or slugs to their numeric hotel IDs.

Overview

Response Time

This endpoint typically responds in 5-12 seconds due to the data extraction process.

The URL to Hotel ID endpoint extracts the numeric hotel ID from any Booking.com hotel URL or slug. This is useful when you have a hotel URL but need the numeric ID for other API calls like the reviews endpoint.

Endpoint URL

GET https://api.stayapi.com/v1/booking/hotel/url-to-id

Use Case

Use this endpoint when you have a Booking.com hotel URL (from a user or another source) and need to get the numeric hotel ID for use with other endpoints.

Parameters

Parameter Type Required Description
url string Required Booking.com hotel URL or slug in any of the accepted formats (see below)

Accepted URL Formats

  • 1

    Full URL

    https://www.booking.com/hotel/th/baan-coconut.html
  • 2

    Country code + slug

    th/baan-coconut
  • 3

    Just the slug

    baan-coconut

    Note: Assumes Thailand (th) as default country

Response Fields

Field Type Description
hotel_id string The numeric Booking.com hotel ID
url string The normalized full Booking.com URL

Code Examples

Request
curl -X GET "https://api.stayapi.com/v1/booking/hotel/url-to-id?url=th/baan-coconut" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "hotel_id": "1302021",
  "url": "https://www.booking.com/hotel/th/baan-coconut.html"
}

Common Workflow

URL to Reviews Flow

  1. 1

    Get Hotel ID from URL

    Call this endpoint with the hotel URL to get the numeric ID.

    GET /v1/booking/hotel/url-to-id?url=th/baan-coconut
  2. 2

    Use Hotel ID for API Calls

    Use the returned hotel_id with other endpoints.

    GET /v1/booking/hotel/reviews?url=https://www.booking.com/hotel/th/baan-coconut.html

Note: This endpoint takes 5-12 seconds to respond. Consider caching hotel IDs on your end for frequently accessed hotels.

Related Endpoints