GET

URL to Hotel ID

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

Copy for your AI agent

Paste into Claude, ChatGPT, Cursor or Copilot — endpoint, parameters, response fields and a curl example in Markdown.

Overview

Response Time

This endpoint extracts data from the live Booking.com page, so it is slower than ID-based endpoints.

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

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: URL resolution fetches the live page, so it is slower than ID-based calls. Cache hotel IDs on your end for frequently accessed hotels.

Related Endpoints

Browse documentation