Search Hotel Prices and Ratings with the Booking.com Hotels API
Finding the best hotel deals across Booking.com doesn't require scraping or complex integrations. The Booking.com Hotels API lets you query real hotel listings with prices, ratings, and availability in a single API call.
What This API Does
This API wraps Booking.com's search functionality, returning structured data for hotels matching your location. You get:
- Hotel names and descriptions
- Real-time pricing
- Guest ratings and review counts
- Amenities and room details
- Availability status
Perfect for building travel comparison tools, vacation planners, or real estate research apps.
Code Example
Here's how to search for hotels in a location using JavaScript's fetch():
const searchHotels = async (location) => {
const options = {
method: 'GET',
headers: {
'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
'x-rapidapi-host': 'booking-com-hotels-api-production.up.railway.app'
}
};
try {
const response = await fetch(
`https://booking-com-hotels-api-production.up.railway.app/api/search?location=${encodeURIComponent(location)}`,
options
);
const data = await response.json();
console.log('Hotels found:', data);
// Example: Display top 5 hotels
data.hotels.slice(0, 5).forEach(hotel => {
console.log(`${hotel.name} - $${hotel.price}/night - ⭐ ${hotel.rating}`);
});
return data;
} catch (error) {
console.error('API Error:', error);
}
};
// Usage
searchHotels('Paris');
What You'll Get Back
The API returns a JSON object with hotel listings:
{
"hotels": [
{
"id": "12345",
"name": "Hotel Example",
"price": 89.99,
"currency": "USD",
"rating": 8.5,
"reviewCount": 234,
"location": "Downtown Paris",
"amenities": ["WiFi", "Parking", "Pool"]
}
]
}
Tips for Using This API
-
URL Encode locations: Always use
encodeURIComponent()for city names with spaces - Handle rate limits: Cache results when possible to avoid hitting quota limits
- Parse prices carefully: Prices may vary by date and occupancy
- Check availability: Some hotels may show prices but have limited availability
Ready to Build?
Sign up on RapidAPI to get your free API key and start searching hotel data today. The free tier includes hundreds of requests monthly—perfect for testing and prototyping.
Build that travel app. Your users will thank you.
Top comments (0)