GET
TripAdvisor Reviews from URL API
Extract hotel reviews directly from any TripAdvisor hotel URL - no location ID needed.
Overview
Simplest Method
Just paste any TripAdvisor hotel URL and get reviews instantly. The API handles location ID extraction automatically.
This endpoint is a convenient wrapper that extracts the location ID from a TripAdvisor URL and retrieves reviews in one step. Perfect when you have the hotel URL but not the location ID.
Endpoint URL
GET https://api.stayapi.com/v1/tripadvisor/hotel/reviews-from-url
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Required | Any valid TripAdvisor hotel URL |
limit | integer | Optional | Number of reviews per page (1-50, default: 10) |
offset | integer | Optional | Pagination offset (default: 0) |
language | string | Optional | Language filter (default: "en") |
Supported URL Formats
This endpoint accepts any valid TripAdvisor hotel URL, including:
-
✓
Standard hotel pages
https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html
-
✓
With page numbers
https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-or10-Hotel.html
-
✓
Different language versions
https://www.tripadvisor.de/Hotel_Review-g1224250-d305165-Reviews-Hotel.html
-
✓
Mobile URLs
https://m.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html
Benefits
Why Use This Endpoint?
- No need to extract location IDs manually
- Works with any TripAdvisor hotel URL format
- Same rich review data as the location ID endpoint
- Perfect for web scraping workflows
- Handles URL validation automatically
Pro Tip
The response includes the extracted location_id, so you can use it for subsequent API calls if needed.
Request
curl -X GET "https://api.stayapi.com/v1/tripadvisor/hotel/reviews-from-url?url=https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html&limit=5" \ -H "x-api-key: YOUR_API_KEY"
// Any TripAdvisor hotel URL const hotelUrl = "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html"; const params = new URLSearchParams({ url: hotelUrl, limit: "10", offset: "0", language: "en" }); const response = await fetch( `https://api.stayapi.com/v1/tripadvisor/hotel/reviews-from-url?${params}`, { headers: { "x-api-key": "YOUR_API_KEY" } } ); const data = await response.json(); // The response includes the extracted location ID console.log(`Location ID: ${data.data.location_id}`); console.log(`Total reviews: ${data.data.total_reviews}`); // Process reviews data.data.reviews.forEach(review => { console.log(`${review.rating}/5 - ${review.title}`); console.log(`Review: ${review.text.substring(0, 150)}...`); });
import requests # Any TripAdvisor hotel URL hotel_url = "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html" url = "https://api.stayapi.com/v1/tripadvisor/hotel/reviews-from-url" headers = {"x-api-key": "YOUR_API_KEY"} params = { "url": hotel_url, "limit": 10, "offset": 0, "language": "en" } response = requests.get(url, headers=headers, params=params) data = response.json() # The API extracts the location ID for you print(f"Extracted Location ID: {data['data']['location_id']}") print(f"Hotel: {data['data']['hotel_name']}") print(f"Total reviews: {data['data']['total_reviews']}") print(f"Average rating: {data['data']['average_rating']}/5\n") # Display reviews for review in data["data"]["reviews"]: stars = "⭐" * review["rating"] print(f"{stars} {review['title']}") print(f"By: {review['user']['username']}") print(f"{review['text'][:200]}...") print("-" * 50)
Response
{ "success": true, "data": { "hotel_name": "The Siam", "location_id": "305165", "extracted_from_url": "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html", "total_reviews": 892, "average_rating": 4.5, "reviews": [ { "review_id": "874521963", "title": "Exceptional luxury hotel with outstanding service", "text": "From the moment we arrived, we were treated like royalty. The staff went above and beyond to ensure our stay was perfect. The room was beautifully appointed with traditional Thai decor and modern amenities.", "rating": 5, "published_date": "2024-01-10", "stay_date": "December 2023", "trip_type": "Couples", "user": { "username": "SarahM_London", "display_name": "Sarah M", "location": "London, UK", "contributions": 47, "helpful_votes": 123, "avatar_url": "https://media-cdn.tripadvisor.com/media/photo-l/user123.jpg" }, "helpful_votes": 8, "photos": [ { "url": "https://media-cdn.tripadvisor.com/media/photo-w/review123.jpg", "caption": "Beautiful pool area" } ], "room_tip": "Request a river view room for stunning sunset views", "language": "en" } ], "pagination": { "limit": 10, "offset": 0, "has_next": true } }, "message": "Successfully retrieved hotel reviews from URL", "retrieved_at": "2024-01-15T10:30:00Z" }
{ "error": "Invalid URL", "detail": "The provided URL is not a valid TripAdvisor hotel URL", "status_code": 400 }