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
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/segmenthttps://www.agoda.com/<slug>/hotel/all/<city>-<country>.htmlNote: 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
Common Workflow
URL to Reviews Flow
-
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
Use Hotel ID for Reviews
Pass the returned
hotel_idto 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.