GET

URL to Hotel ID

Convert Agoda hotel URLs to their numeric hotel IDs.

Overview

Response Time

This endpoint typically responds in 1-3 seconds.

The URL to Hotel ID endpoint extracts the numeric hotel ID from an Agoda hotel URL. Use it whenever you have a hotel URL from a user or another source and need the numeric ID to call other Agoda endpoints like hotel reviews.

Endpoint URL

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

Use Case

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

Parameters

Parameter Type Required Description
url string Required Full Agoda hotel URL (see accepted formats below)

Accepted URL Formats

  • 1

    Hotel detail URL

    https://www.agoda.com/<slug>/hotel/<city>-<country>.html
  • 2

    Hotel detail URL with /all/ segment

    https://www.agoda.com/<slug>/hotel/all/<city>-<country>.html

    Note: Query strings and fragments are stripped before lookup.

Response Fields

Field Type Description
hotel_id integer The numeric Agoda hotel ID
url string The normalized Agoda URL (query string and fragment removed)

Code Examples

Request
curl -X GET "https://api.stayapi.com/v1/agoda/hotel/url-to-id?url=https://www.agoda.com/oulu-hotelli-apartments/hotel/all/oulu-fi.html" \
  -H "x-api-key: YOUR_API_KEY"
Response
{
  "hotel_id": 356812,
  "url": "https://www.agoda.com/oulu-hotelli-apartments/hotel/all/oulu-fi.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/agoda/hotel/url-to-id?url=https://www.agoda.com/oulu-hotelli-apartments/hotel/all/oulu-fi.html
  2. 2

    Use Hotel ID for Reviews

    Pass the returned hotel_id to the reviews endpoint.

    GET /v1/agoda/hotel/reviews/356812

Note: Cache hotel IDs on your end for frequently accessed hotels. The numeric ID never changes for a given hotel.

Related Endpoints