TripAdvisor Prices from URL API
Get real-time hotel prices directly from any TripAdvisor URL - no location ID needed.
Overview
URL-Based Pricing
Simply paste a TripAdvisor hotel URL and get current prices from all booking providers in one API call.
This endpoint combines URL parsing and price retrieval in a single request. Perfect for price comparison tools, browser extensions, or any workflow where you have hotel URLs.
Endpoint URL
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Required | Any valid TripAdvisor hotel URL |
check_in | string | Required | Check-in date (YYYY-MM-DD) |
check_out | string | Required | Check-out date (YYYY-MM-DD) |
adults | integer | Optional | Number of adult guests (1-8, default: 2) |
rooms | integer | Optional | Number of rooms (1-4, default: 1) |
currency | string | Optional | Currency code (default: "USD") |
Perfect For
Browser Extensions
Build price comparison extensions that work on any TripAdvisor hotel page. Users can see prices without leaving the site.
Price Monitoring
Track price changes for specific hotels over time. Just store the URL and check prices periodically.
Travel Planning Tools
Let users paste TripAdvisor links to compare prices across their shortlisted hotels.
Automated Workflows
Integrate with web scraping or automation tools that collect hotel URLs.
Example Workflow
- User browses TripAdvisor and finds an interesting hotel
- User copies the URL from their browser
- Your application calls this API with the URL and desired dates
- API returns prices from all available booking sites
- User compares prices and books through their preferred provider
URL Flexibility
This endpoint accepts any TripAdvisor hotel URL format - mobile, desktop, different domains, with or without review pages.
curl -X GET "https://api.stayapi.com/v1/tripadvisor/hotel/prices-from-url?url=https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html&check_in=2025-08-01&check_out=2025-08-03" \ -H "x-api-key: YOUR_API_KEY"
// User provides a TripAdvisor URL const hotelUrl = "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html"; // Set travel dates const checkIn = "2025-08-01"; const checkOut = "2025-08-03"; const params = new URLSearchParams({ url: hotelUrl, check_in: checkIn, check_out: checkOut, adults: "2", rooms: "1", currency: "USD" }); const response = await fetch( `https://api.stayapi.com/v1/tripadvisor/hotel/prices-from-url?${params}`, { headers: { "x-api-key": "YOUR_API_KEY" } } ); const data = await response.json(); // Display results console.log(`Hotel: ${data.data.hotel_name}`); console.log(`Location ID: ${data.data.location_id}`); console.log(`Dates: ${data.data.check_in} to ${data.data.check_out}`); console.log(`\nPrice Comparison:`); // Sort by price and display const sortedPrices = data.data.prices.sort((a, b) => a.price_amount - b.price_amount); sortedPrices.forEach((offer, index) => { const savings = index > 0 ? `(+$${(offer.price_amount - sortedPrices[0].price_amount).toFixed(2)})` : "(BEST PRICE)"; console.log(`${offer.provider_name}: ${offer.price} ${savings}`); }); // Show booking link for best price if (sortedPrices.length > 0) { console.log(`\nBook best price at: ${sortedPrices[0].booking_url}`); }
import requests from urllib.parse import quote # TripAdvisor hotel URL (from user input or database) hotel_url = "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html" # API endpoint and parameters api_url = "https://api.stayapi.com/v1/tripadvisor/hotel/prices-from-url" headers = {"x-api-key": "YOUR_API_KEY"} params = { "url": hotel_url, "check_in": "2025-08-01", "check_out": "2025-08-03", "adults": 2, "rooms": 1, "currency": "USD" } response = requests.get(api_url, headers=headers, params=params) data = response.json() # Display hotel info print(f"Hotel: {data['data']['hotel_name']}") print(f"Extracted Location ID: {data['data']['location_id']}") print(f"Check-in: {data['data']['check_in']}") print(f"Check-out: {data['data']['check_out']}") print(f"Total nights: {data['data']['nights']}") # Analyze prices prices = data["data"]["prices"] if prices: # Find best and worst prices sorted_prices = sorted(prices, key=lambda x: x["price_amount"]) best_deal = sorted_prices[0] most_expensive = sorted_prices[-1] print(f"\nPrice Range:") print(f" Best: {best_deal['provider_name']} - {best_deal['price']}") print(f" Highest: {most_expensive['provider_name']} - {most_expensive['price']}") # Calculate potential savings savings = most_expensive["price_amount"] - best_deal["price_amount"] print(f" Potential savings: ${savings:.2f}") # Show all prices print(f"\nAll {len(prices)} Available Rates:") for i, offer in enumerate(sorted_prices, 1): special = f" - {offer['special_offer']}" if offer.get("special_offer") else "" print(f"{i}. {offer['provider_name']:15} {offer['price']:>8}{special}") # Booking recommendation print(f"\nRecommendation:") print(f"Book with {best_deal['provider_name']} to save ${savings:.2f}") print(f"Booking URL: {best_deal['booking_url']}") else: print("No prices available for the selected dates")
{ "success": true, "data": { "location_id": "305165", "extracted_from_url": "https://www.tripadvisor.com/Hotel_Review-g1224250-d305165-Reviews-Hotel.html", "hotel_name": "The Siam", "check_in": "2025-08-01", "check_out": "2025-08-03", "nights": 2, "adults": 2, "rooms": 1, "currency": "USD", "prices": [ { "provider_name": "Booking.com", "provider_logo": "https://static.tacdn.com/img2/branding/hotels/booking_logo.png", "price": "$450", "price_amount": 450.00, "price_type": "per_night", "total_price": "$900", "total_amount": 900.00, "booking_url": "https://www.tripadvisor.com/Commerce?p=BookingCom&src=123456", "special_offer": null }, { "provider_name": "Hotels.com", "provider_logo": "https://static.tacdn.com/img2/branding/hotels/hotelscom_logo.png", "price": "$442", "price_amount": 442.00, "price_type": "per_night", "total_price": "$884", "total_amount": 884.00, "booking_url": "https://www.tripadvisor.com/Commerce?p=HotelsCom2&src=123456", "special_offer": "Collect 1 free night" }, { "provider_name": "Official Site", "provider_logo": null, "price": "$425", "price_amount": 425.00, "price_type": "per_night", "total_price": "$850", "total_amount": 850.00, "booking_url": "https://www.thesiamhotel.com/reservations", "special_offer": "Best rate guarantee" } ], "summary": { "lowest_price": "$425", "lowest_provider": "Official Site", "highest_price": "$450", "highest_provider": "Booking.com", "average_price": "$439.00", "provider_count": 3, "currency": "USD" } }, "message": "Successfully retrieved hotel prices 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 }