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 |
| page | integer | Optional | Page number, starts at 1 (default: 1) |
| per_page | integer | Optional | Number of reviews per page (1-50, default: 10) |
| 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 automated data collection 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&page=1&per_page=10" \ -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, page: "1", per_page: "10", 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 and pagination console.log(`Location ID: ${data.location_id}`); console.log(`Page ${data.pagination.page} of ${data.pagination.total_pages}`); console.log(`Total reviews: ${data.total_count}`); // Process reviews data.reviews.forEach(review => { console.log(`${review.rating}/5 - ${review.title}`); console.log(`Review: ${review.text.substring(0, 150)}...`); }); // Get next page if (data.pagination.has_next) { params.set("page", "2"); // Fetch next page... }
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, "page": 1, "per_page": 10, "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['location_id']}") print(f"Page {data['pagination']['page']} of {data['pagination']['total_pages']}") print(f"Total reviews: {data['total_count']}\n") # Display reviews for review in data["reviews"]: print(f"{review['rating']}/5 - {review['title']}") print(f"By: {review['user']['display_name']}") print(f"{review['text'][:200]}...") print("-" * 50) # Fetch all pages while data["pagination"]["has_next"]: params["page"] += 1 response = requests.get(url, headers=headers, params=params) data = response.json() # Process more reviews...
Response
{ "success": true, "reviews": [ { "id": 874521963, "rating": 5, "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.", "language": "en", "created_date": "2024-01-10", "published_date": "2024-01-10", "helpful_votes": 8, "user": { "id": "ABC123", "display_name": "Sarah M", "username": "SarahM_London", "is_verified": false, "contribution_count": 47, "hometown": "London, UK", "avatar_url": "https://media-cdn.tripadvisor.com/..." }, "trip_info": { "stay_date": "2023-12-15", "trip_type": "COUPLES" }, "additional_ratings": { "value": 5, "service": 5, "cleanliness": 5 }, "photos": [], "review_url": "https://www.tripadvisor.com/ShowUserReviews-..." } ], "total_count": 336, "review_count": 10, "location_id": 305165, "pagination": { "page": 1, "per_page": 10, "total_count": 336, "total_pages": 34, "has_next": true, "has_previous": false } }
{ "error": "Invalid URL", "detail": "The provided URL is not a valid TripAdvisor hotel URL", "status_code": 400 }