Agoda Reviews from URL API
Extract hotel reviews directly from any Agoda hotel URL without needing to know the hotel ID.
Overview
Automatic Hotel ID Extraction
Simply provide any Agoda hotel URL and the API will automatically extract the hotel ID and fetch reviews.
This endpoint simplifies the review extraction process by accepting any valid Agoda hotel URL. The API automatically identifies the hotel ID from the URL and retrieves all review data, making it perfect for applications that work with URLs rather than IDs.
Endpoint URL
Supported URL Formats
Valid Agoda URL Patterns
https://www.agoda.com/hotel-name/hotel/city-country.html
Standard hotel page URL
https://www.agoda.com/hotel-name/hotel/all/city-country.html
Hotel page with all locations
https://www.agoda.com/en-us/hotel-name/hotel/city.html
Localized URL with language prefix
agoda.com/hotel-123456.html
Short format with hotel ID in URL
URL Parameters
Query parameters like check-in dates, guest counts, etc. are ignored. Only the hotel identifier is extracted.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Required | Full Agoda hotel URL (query parameter) |
page | integer | Optional | Page number for pagination (starts at 1, default: 1) |
page_size | integer | Optional | Number of reviews per page (1-20, default: 5) |
sorting | integer | Optional | Sort order: 7 = most recent, 6 = highest rating, 5 = lowest rating (default: 7) |
How It Works
URL Validation
The API validates that the provided URL is from agoda.com domain.
Hotel ID Extraction
The system automatically extracts the hotel ID from the URL by analyzing the page content.
Review Fetching
Reviews are retrieved using the extracted hotel ID with your specified parameters.
Response Delivery
Complete review data is returned in the same format as the standard reviews endpoint.
Usage Examples
Basic Review Extraction
Extract reviews from any Agoda hotel page:
With Pagination
Get specific page of reviews:
Sorted by Rating
Get highest-rated reviews first:
Error Handling
Invalid URL
The provided URL is not a valid Agoda hotel URL
{
"error": {
"code": "INVALID_URL",
"message": "The provided URL is not a valid Agoda hotel URL"
}
}
Hotel ID Not Found
Could not extract hotel ID from the provided URL
{
"error": {
"code": "HOTEL_ID_NOT_FOUND",
"message": "Could not extract hotel ID from the provided URL"
}
}
URL Requirements
Ensure the URL points to a valid Agoda hotel page, not search results or other pages.
Best Practices
Recommendations
- Validate URLs on the client side before making API calls
- Cache the extracted hotel ID for subsequent requests
- Use URL encoding for special characters in the URL parameter
- Consider using the direct hotel ID endpoint if you already have the ID
- Handle pagination based on the total_pages returned in the response
- Implement retry logic for temporary extraction failures
curl -X GET "https://api.stayapi.com/v1/agoda/hotel/reviews-from-url" \ -G \ --data-urlencode "url=https://www.agoda.com/omena-hotel-jyvaskyla/hotel/jyvaskyla-fi.html" \ --data-urlencode "page=1" \ --data-urlencode "page_size=5" \ -H "X-API-Key: YOUR_API_KEY"
// Extract reviews from Agoda URL const hotelUrl = 'https://www.agoda.com/omena-hotel-jyvaskyla/hotel/jyvaskyla-fi.html'; const params = new URLSearchParams({ url: hotelUrl, page: 1, page_size: 10 }); const response = await fetch( `https://api.stayapi.com/v1/agoda/hotel/reviews-from-url?${params}`, { headers: { 'X-API-Key': 'YOUR_API_KEY' } } ); const data = await response.json(); if (data.success) { console.log(`Hotel ID: ${data.hotel_id}`); console.log(`Total reviews: ${data.pagination.total_count}`); // Process reviews data.reviews.forEach(review => { console.log(`${review.rating}/10 - ${review.title}`); console.log(`By: ${review.reviewer.name}`); }); } else { console.error('Failed to extract reviews:', data.error); }
import requests from urllib.parse import urlencode # Agoda hotel URL hotel_url = 'https://www.agoda.com/omena-hotel-jyvaskyla/hotel/jyvaskyla-fi.html' # Build query parameters params = { 'url': hotel_url, 'page': 1, 'page_size': 10, 'sorting': 7 # Most recent } headers = { 'X-API-Key': 'YOUR_API_KEY' } # Make request response = requests.get( 'https://api.stayapi.com/v1/agoda/hotel/reviews-from-url', params=params, headers=headers ) data = response.json() if data.get('success'): print(f"Extracted hotel ID: {data['hotel_id']}") print(f"Hotel name: {data.get('hotel_name', 'N/A')}") print(f"Total reviews: {data['pagination']['total_count']}") # Analyze reviews for review in data['reviews']: print(f"\n{review['rating']}/10 - {review['title']}") print(f"Comment: {review['comment'][:100]}...") print(f"Reviewer: {review['reviewer']['name']} ({review['reviewer']['group_type']})") else: print(f"Error: {data.get('error', {}).get('message')}")
<?php // Agoda hotel URL $hotel_url = 'https://www.agoda.com/omena-hotel-jyvaskyla/hotel/jyvaskyla-fi.html'; // Build query parameters $params = http_build_query([ 'url' => $hotel_url, 'page' => 1, 'page_size' => 10, 'sorting' => 7 ]); $ch = curl_init("https://api.stayapi.com/v1/agoda/hotel/reviews-from-url?{$params}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-API-Key: YOUR_API_KEY' ]); $response = curl_exec($ch); $data = json_decode($response, true); curl_close($ch); if ($data['success']) { echo "Extracted hotel ID: " . $data['hotel_id'] . "\n"; echo "Total reviews: " . $data['pagination']['total_count'] . "\n"; echo "Pages available: " . $data['pagination']['total_pages'] . "\n\n"; foreach ($data['reviews'] as $review) { echo $review['rating'] . "/10 - " . $review['title'] . "\n"; echo "Guest: " . $review['reviewer']['name'] . "\n"; echo "Stay date: " . $review['stay_date'] . "\n"; echo "---\n"; } } else { echo "Error: " . $data['error']['message'] . "\n"; }
require 'net/http' require 'json' require 'cgi' # Agoda hotel URL hotel_url = 'https://www.agoda.com/omena-hotel-jyvaskyla/hotel/jyvaskyla-fi.html' # Build URL with parameters uri = URI('https://api.stayapi.com/v1/agoda/hotel/reviews-from-url') params = { url: hotel_url, page: 1, page_size: 10, sorting: 7 } uri.query = URI.encode_www_form(params) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri) request['X-API-Key'] = 'YOUR_API_KEY' response = http.request(request) data = JSON.parse(response.body) if data['success'] puts "Extracted hotel ID: #{data['hotel_id']}" puts "Total reviews: #{data['pagination']['total_count']}" puts "\nReviews:" data['reviews'].each do |review| puts "#{review['rating']}/10 - #{review['title']}" puts " By: #{review['reviewer']['name']} (#{review['reviewer']['country']}})" puts " Date: #{review['date']}" puts '---' end else puts "Error: #{data['error']['message']}" end
{ "success": true, "hotel_id": 319457, "hotel_name": "Omena Hotel Jyvaskyla", "reviews": [ { "review_id": "1013949992", "rating": 10.0, "title": "Thanks a lot for Omena Call Support", "comment": "Omena Call Support helped me to get my check-in link...", "pros": "", "cons": "", "reviewer": { "name": "Shintaro", "country": "Japan", "level": "", "group_type": "Group" }, "date": "August 22, 2025", "stay_date": "August 2025", "room_type": "Double Room", "helpful_count": 0, "language": "en", "photos": [], "sub_ratings": { "cleanliness": 9.0, "location": 9.5, "service": 8.0 } } ], "pagination": { "current_page": 1, "page_size": 5, "total_count": 1459, "total_pages": 292 }, "review_score": { "overall": 7.9, "score_text": "Very good", "review_count": 1459 }, "retrieved_at": "2025-09-04T10:30:00Z" }
{ "error": { "code": "HOTEL_ID_NOT_FOUND", "message": "Could not extract hotel ID from the provided URL", "status": 400 } }