Booking API - Complete Tutorial
Table of Contents
Introduction
Booking com API provides access to a vast database of accommodation listings, including over 28 million reported properties worldwide. This API allows you to:
- Search for hotels, apartments, and unique accommodations
- View prices, photos, and reviews
- Find car rental deals
- Build travel applications similar to hotels.com, booking.com, or agoda.com
Base URL: https://booking-com.p.rapidapi.com
Support: tipsters@rapi.one | https://t.me/api_tipsters
Other Travel APIs: https://rapi.one/travel/
Getting Started
What is RapidAPI?
RapidAPI is the world's largest API hub where over three million developers find, test, and connect to thousands of APIs — all with a single account and API key.
Quick Start Steps
- Sign Up - Create an account at RapidAPI
- Subscribe - Subscribe to the Booking API
- Test - Test endpoints directly from the browser
- Integrate - Add the API to your application
- Build - Create your travel application!
Documentation:
Pricing
The API offers a free tier with monthly request limits. For higher limits or custom plans, contact support at tipsters@rapi.one.
RapidAPI Consumer Quick Start Guide
Connect and get an API key
API Providers:
API Reference
Metadata Endpoints
Exchange Rates
GET /v1/metadata/exchange-rates
Get currency exchange rates.
| Parameter | Type | Required | Description |
|---|---|---|---|
locale | Locale | Yes | Language locale (e.g., en-gb) |
currency | Currency | Yes | Target currency code (e.g., USD) |
Hotels Endpoints (v1)
Search Locations
GET /v1/hotels/locations
Search locations or hotels by name. Returns destination IDs needed for hotel searches.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
name | string | Yes | Location or hotel name | Berlin |
Response Example:
[
{
"name": "London",
"dest_type": "city",
"dest_id": "-2601889",
"country": "United Kingdom",
"label": "London, Greater London, United Kingdom",
"latitude": 51.507391,
"longitude": -0.127634,
"nr_hotels": 14510
}
]Search Hotels
GET /v1/hotels/search
Get available hotels by destination, dates, and guest count. Use page_number for pagination.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
dest_type | DestType | Yes | Destination type | city |
dest_id | integer | Yes | Destination ID from Search Locations | -553173 |
checkin_date | string | Yes | Check-in date (YYYY-MM-DD) | 2027-01-11 |
checkout_date | string | Yes | Check-out date (YYYY-MM-DD) | 2027-01-12 |
room_number | integer | Yes | Number of rooms | 1 |
adults_number | integer | Yes | Number of adults | 2 |
filter_by_currency | Currency | Yes | Currency for prices | USD |
order_by | HotelsSearchOrderBy | Yes | Sort order | popularity |
units | HotelsSearchUnits | Yes | Unit system | metric |
children_number | integer | No | Number of children | 2 |
children_ages | string | No | Ages of children (comma-separated, 0=infant) | 5,0 |
page_number | integer | No | Page number for pagination | 0 |
categories_filter_ids | string | No | Filter IDs (use Search Filters endpoint) | class::2,class::4 |
include_adjacency | boolean | No | Include nearby locations | true |
Search Filters
GET /v1/hotels/search-filters
Get available filters for hotel search (star rating, amenities, price ranges, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
dest_type | DestType | Yes | Destination type | city |
dest_id | integer | Yes | Destination ID | -553173 |
checkin_date | string | Yes | Check-in date | 2027-01-11 |
checkout_date | string | Yes | Check-out date | 2027-01-12 |
room_number | integer | Yes | Number of rooms | 1 |
adults_number | integer | Yes | Number of adults | 2 |
filter_by_currency | Currency | Yes | Currency | USD |
order_by | HotelsSearchOrderBy | Yes | Sort order | popularity |
units | HotelsSearchUnits | Yes | Unit system | metric |
Hotel Data
GET /v1/hotels/data
Get basic hotel information by hotel_id.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Hotel Photos
GET /v1/hotels/photos
Get all photos of a hotel.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Hotel Review Scores
GET /v1/hotels/review-scores
Get review scores and ratings breakdown.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Hotel Location Highlights
GET /v1/hotels/location-highlights
Get nearby transportation and landmarks (metro, rail, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Hotel Description
GET /v1/hotels/description
Get full hotel description.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Hotel Questions
GET /v1/hotels/questions
Get Q&A between guests and hotel staff.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Payment Features
GET /v1/hotels/payment-features
Get accepted payment methods and features.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Policies
GET /v1/hotels/policies
Get hotel policies (check-in/out times, cancellation, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Facilities
GET /v1/hotels/facilities
Get hotel amenities (Restaurant, Room service, Breakfast, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Map Markers
GET /v1/hotels/map-markers
Get geographic coordinates and nearby landmarks.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Nearby Places
GET /v1/hotels/nearby-places
Get nearby points of interest (airports, shopping centers, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Children Policy
GET /v1/hotels/children-policies
Get policies regarding children.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
children_age | integer | No | Child age to check | 5 |
Hotel Reviews
GET /v1/hotels/reviews
Get guest reviews with filtering and sorting options.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
sort_type | HotelsReviewsSortType | Yes | Sort order | SORT_MOST_RELEVANT |
page_number | integer | No | Page number | 0 |
customer_type | string | No | Filter by traveler type | solo_traveller |
language_filter | string | No | Filter by review language | en-gb,de,fr |
Hotel Tips
GET /v1/hotels/tips
Get guest tips and recommendations.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
sort_type | HotelsReviewsSortType | Yes | Sort order | SORT_MOST_RELEVANT |
page_number | integer | No | Page number | 0 |
customer_type | string | No | Filter by traveler type | solo_traveller |
language_filter | string | No | Filter by review language | en-gb,de,fr |
Hotel Reviews Metadata
GET /v1/hotels/reviews-filter-metadata
Get metadata for review filtering (available languages, traveler types, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1676161 |
Hotel Room List
GET /v1/hotels/room-list
Get available rooms with prices, photos, and descriptions.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
currency | Currency | Yes | Currency | USD |
units | HotelsSearchUnits | Yes | Unit system | metric |
hotel_id | integer | Yes | Hotel ID | 1676161 |
checkin_date | string | Yes | Check-in date | 2027-01-11 |
checkout_date | string | Yes | Check-out date | 2027-01-12 |
adults_number_by_rooms | string | Yes | Adults per room (comma-separated) | 3,1 |
children_number_by_rooms | string | No | Children per room (comma-separated) | 2,1 |
children_ages | string | No | Ages of all children | 5,0,9 |
Nearby Cities
GET /v1/hotels/nearby-cities
Get cities near specified coordinates.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
latitude | number | Yes | Latitude | 65.9667 |
longitude | number | Yes | Longitude | -18.5333 |
Search Hotels by Coordinates
GET /v1/hotels/search-by-coordinates
Find hotels near specific coordinates (latitude/longitude).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
latitude | number | Yes | Latitude | 65.9667 |
longitude | number | Yes | Longitude | -18.5333 |
checkin_date | string | Yes | Check-in date | 2027-01-11 |
checkout_date | string | Yes | Check-out date | 2027-01-12 |
room_number | integer | Yes | Number of rooms | 1 |
adults_number | integer | Yes | Number of adults | 2 |
filter_by_currency | Currency | Yes | Currency | USD |
order_by | HotelsSearchOrderBy | Yes | Sort order | popularity |
units | HotelsSearchUnits | Yes | Unit system | metric |
children_number | integer | No | Number of children | 2 |
children_ages | string | No | Ages of children | 5,0 |
page_number | integer | No | Page number | 0 |
categories_filter_ids | string | No | Filter IDs | class::2,class::4 |
include_adjacency | boolean | No | Include nearby locations | true |
Hotels Endpoints (v2)
Version 2 endpoints provide enhanced functionality.
Search Filters (v2)
GET /v2/hotels/search-filters
Enhanced search filters with price range support.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
dest_type | DestType | Yes | Destination type | city |
dest_id | integer | Yes | Destination ID | -553173 |
checkin_date | string | Yes | Check-in date | 2027-01-11 |
checkout_date | string | Yes | Check-out date | 2027-01-12 |
room_number | integer | Yes | Number of rooms | 1 |
adults_number | integer | Yes | Number of adults | 2 |
filter_by_currency | Currency | Yes | Currency | USD |
order_by | HotelsSearchOrderBy | Yes | Sort order | popularity |
units | HotelsSearchUnits | Yes | Unit system | metric |
categories_filter_ids | string | No | Filters including price ranges | price::USD-140-190 |
Price Filter Formats:
- Range:
price::USD-140-190 - Minimum:
price::USD-150-min - Maximum:
price::USD-150-max
Hotels Search (v2)
GET /v2/hotels/search
Enhanced hotel search with additional filtering options.
Same parameters as v1, with enhanced categories_filter_ids supporting price ranges.
Hotels Details (v2)
GET /v2/hotels/details
Get comprehensive hotel details.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
currency | Currency | Yes | Currency | USD |
hotel_id | integer | Yes | Hotel ID | 1676161 |
checkin_date | string | Yes | Check-in date | 2027-01-11 |
checkout_date | string | Yes | Check-out date | 2027-01-12 |
Hotel Description (v2)
GET /v2/hotels/description
Get hotel description.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
hotel_id | integer | Yes | Hotel ID | 1377073 |
Meta Properties
GET /v2/hotels/meta-properties
Get meta properties description for SEO and display purposes.
Car Rental Endpoints
Search Car Locations
GET /v1/car-rental/locations
Search car rental pickup/dropoff locations by name.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
name | string | Yes | Location name | Berlin |
Search Car Rental
GET /v1/car-rental/search
Search available rental cars.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
currency | Currency | Yes | Currency | USD |
sort_by | CarsSortBy | Yes | Sort order | recommended |
from_country | CarsCor | Yes | Country code | de |
pick_up_datetime | string | Yes | Pickup date/time | 2027-01-12 09:00:00 |
drop_off_datetime | string | Yes | Dropoff date/time | 2027-01-13 09:00:00 |
pick_up_latitude | number | Yes | Pickup latitude | 50.08773 |
pick_up_longitude | number | Yes | Pickup longitude | 14.421133 |
drop_off_latitude | number | Yes | Dropoff latitude | 50.08773 |
drop_off_longitude | number | Yes | Dropoff longitude | 14.421133 |
Car Rental Details
GET /v1/car-rental/detail
Get details for a specific vehicle.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
currency | Currency | Yes | Currency | USD |
from_country | CarsCor | Yes | Country code | de |
vehicle_id | integer | Yes | Vehicle ID from search | 699544941 |
search_key | string | Yes | Search key from search results | (encoded string) |
Rental Terms
GET /v1/car-rental/terms-conditions
Get rental terms and conditions.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
from_country | CarsCor | Yes | Country code | de |
pick_up_location_id | integer | Yes | Pickup location ID | 4516789 |
Important Information
GET /v1/car-rental/important-info
Get important vehicle information.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
from_country | CarsCor | Yes | Country code | de |
vehicle_id | integer | Yes | Vehicle ID | 663317713 |
driver_age | integer | Yes | Driver age | 30 |
pick_up_location_id | integer | Yes | Pickup location ID | 4123205 |
drop_off_location_id | integer | Yes | Dropoff location ID | 4123205 |
pick_up_datetime | string | Yes | Pickup date/time | 2027-01-11 09:00:00 |
drop_off_datetime | string | Yes | Dropoff date/time | 2027-01-12 09:00:00 |
Rental Extras
GET /v1/car-rental/extras
Get additional services (insurance, GPS, etc.).
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
from_country | CarsCor | Yes | Country code | de |
currency | Currency | Yes | Currency | USD |
vehicle_id | integer | Yes | Vehicle ID | 663317713 |
price | number | Yes | Base price | 2860.87 |
driver_age | integer | Yes | Driver age | 30 |
pick_up_datetime | string | Yes | Pickup date/time | 2027-01-11 09:00:00 |
drop_off_datetime | string | Yes | Dropoff date/time | 2027-01-12 09:00:00 |
Vehicle Supplier Details
GET /v1/car-rental/supplier/details
Get rental company details.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
from_country | CarsCor | Yes | Country code | de |
vehicle_id | integer | Yes | Vehicle ID | 699544941 |
Supplier Reviews
GET /v1/car-rental/supplier/reviews
Get reviews for rental suppliers.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
locale | Locale | Yes | Language locale | en-gb |
from_country | CarsCor | Yes | Country code | de |
location_id | integer | Yes | Location ID | 4123205 |
Static Data Endpoints
These endpoints provide reference data for filtering and display.
Cities List
GET /v1/static/cities
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
name | string | No | City name | Paris |
city_id | integer | No | City ID | |
country | string | No | Country code | fr |
latitude | string | No | Latitude | |
longitude | string | No | Longitude | |
page | integer | No | Page number | 0 |
Countries List
GET /v1/static/country
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
country | string | No | Country code | us |
Hotel Chains
GET /v1/static/chain-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
chain_id | string | No | Chain ID | |
name | string | No | Chain name | Hilton |
Districts
GET /v1/static/districts
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
name | string | No | District name | |
city_id | string | No | City ID | |
district_id | string | No | District ID | |
country | string | No | Country code | |
page | integer | No | Page number | 0 |
Facility Types
GET /v1/static/facility-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
facility_id | integer | No | Facility ID |
Hotel Facility Types
GET /v1/static/hotel-facility-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
facility_type_id | string | No | Facility type ID | |
hotel_facility_type_id | string | No | Hotel facility type ID |
Hotel Types
GET /v1/static/hotel-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
hotel_type_id | string | No | Hotel type ID |
Payment Types
GET /v1/static/payment-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
payment_id | string | No | Payment ID |
Regions
GET /v1/static/regions
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
name | string | No | Region name | |
country | string | No | Country code | |
region_id | string | No | Region ID | |
region_type | string | No | Region type | |
page | integer | No | Page number | 0 |
Hotels List
GET /v1/static/hotels
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
name | string | No | Hotel name | |
slug | string | No | URL slug | ad/plaza |
hotel_id | integer | No | Hotel ID | |
city_id | integer | No | City ID | |
country | string | No | Country code | |
region_id | integer | No | Region ID | |
district_id | integer | No | District ID | |
hotel_type_id | integer | No | Hotel type ID | |
zip_code | string | No | ZIP code | |
exact_class | integer | No | Star rating | |
page | integer | No | Page number | 0 |
Room Facility Types
GET /v1/static/room-facility-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
room_facility_type_id | string | No | Room facility type ID | |
facility_type_id | string | No | Facility type ID |
Room Types
GET /v1/static/room-types
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
room_type_id | string | No | Room type ID |
Enumerations & Schemas
Locale
Supported language locales:
| Value | Language |
|---|---|
en-gb | English (UK) |
en-us | English (US) |
de | German |
nl | Dutch |
fr | French |
es | Spanish |
es-ar | Spanish (Argentina) |
es-mx | Spanish (Mexico) |
ca | Catalan |
it | Italian |
pt-pt | Portuguese (Portugal) |
pt-br | Portuguese (Brazil) |
no | Norwegian |
fi | Finnish |
sv | Swedish |
da | Danish |
cs | Czech |
hu | Hungarian |
ro | Romanian |
ja | Japanese |
zh-cn | Chinese (Simplified) |
zh-tw | Chinese (Traditional) |
pl | Polish |
el | Greek |
ru | Russian |
tr | Turkish |
bg | Bulgarian |
ar | Arabic |
ko | Korean |
he | Hebrew |
lv | Latvian |
uk | Ukrainian |
id | Indonesian |
ms | Malay |
th | Thai |
et | Estonian |
hr | Croatian |
lt | Lithuanian |
sk | Slovak |
sr | Serbian |
sl | Slovenian |
vi | Vietnamese |
tl | Filipino |
is | Icelandic |
Currency
Supported currency codes:
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUP, CVE, CYP, CZK, DJF, DKK, DOP, DZD, EEK, EUR, EGP, ETB, FJD, GBP, GEL, GHS, GMD, GNF, GRD, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MTL, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, ROL, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SIT, SKK, SLL, SOS, SRD, STD, SVC, SYP, SZL, THB, TJS, TMM, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEB, VEF, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMK, ZMW
DestType (Destination Type)
| Value | Description |
|---|---|
city | City |
region | Region/State |
landmark | Landmark |
district | District/Neighborhood |
hotel | Specific hotel |
country | Country |
airport | Airport |
latlong | GPS coordinates |
HotelsSearchOrderBy (Sort Options)
| Value | Description |
|---|---|
popularity | Most popular first |
class_ascending | Star rating (low to high) |
class_descending | Star rating (high to low) |
distance | Distance from center |
upsort_bh | Booking recommendation |
review_score | Guest rating |
price | Price (low to high) |
HotelsSearchUnits
| Value | Description |
|---|---|
metric | Kilometers |
imperial | Miles |
HotelsReviewsSortType
| Value | Description |
|---|---|
SORT_MOST_RELEVANT | Most relevant reviews |
SORT_RECENT_DESC | Newest first |
SORT_RECENT_ASC | Oldest first |
SORT_SCORE_DESC | Highest score first |
SORT_SCORE_ASC | Lowest score first |
CarsSortBy
| Value | Description |
|---|---|
recommended | Recommended cars |
price_low_to_high | Price (low to high) |
CarsCor (Car Rental Countries)
Supported country codes for car rental:
it, de, nl, fr, es, ca, no, fi, sv, da, cs, hu, ro, ja, pl, el, ru, tr, bg, ar, ko, he, lv, uk, id, ms, th, et, hr, lt, sk, sr, sl, vi, tl
Customer Type (Reviews)
Filter reviews by traveler type:
total- All reviewssolo_traveller- Solo travelersyoung_couple- Young couplesmature_couple- Mature couplesfamily_with_young_children- Families with young childrenfamily_with_older_children- Families with older childrenwith_friends- Friends traveling togethergroup- Groupsreview_category_couples- All couplesreview_category_families- All familiesreview_category_group_of_friends- Groups of friends
Charge Types
CITYTAX- City/tourist taxSERVICECHARGE- Service chargeVAT- Value added tax
Facility Fee Types
Types of facilities that may have additional fees:
SPA, SAUNA, HOTTUB, FITNESSCENTER, BICYCLERENTAL, MASSAGE, TENNISCOURT, LAUNDRY, VALETPARKING, SOLARIUM, TURKISHSTEAMBATH, PRIVATECHEF, HOTSPRINGBATH, LOCKERSAFE, EXCURSION, BBQFACILITIES, IRONING, UMBRELLA, WATERPARK, GOLFCOURSE, SUNBED, HIKING, BEAUTYSALON, DIVING, POOL, PRIVATEBEACHAREA, HIGHCHAIR, CARRENTAL, BABYSITTING
Workflow Examples
Prerequisites
Replace YOUR_RAPIDAPI_KEY with your actual RapidAPI key in all examples below.
Example 1: Basic Hotel Search
Step-by-Step Flow
Step 1: Search for destination
GET /v1/hotels/locations?name=London&locale=en-gb
Response: dest_id = "-2601889", dest_type = "city"
Step 2: Get available filters (optional)
GET /v1/hotels/search-filters?dest_id=-2601889&dest_type=city&...
Step 3: Search hotels
GET /v1/hotels/search?dest_id=-2601889&dest_type=city&checkin_date=2027-01-11&checkout_date=2027-01-12&adults_number=2&room_number=1&...
Step 4: Get hotel details
GET /v1/hotels/data?hotel_id=1377073&locale=en-gb
GET /v1/hotels/photos?hotel_id=1377073&locale=en-gb
GET /v1/hotels/reviews?hotel_id=1377073&...Python Example
import requests
import json
# Configuration
RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
BASE_URL = "https://booking-com.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
def search_locations(name, locale="en-gb"):
"""Search for destinations by name"""
url = f"{BASE_URL}/v1/hotels/locations"
params = {"name": name, "locale": locale}
response = requests.get(url, headers=headers, params=params)
return response.json()
def search_hotels(dest_id, dest_type, checkin_date, checkout_date,
adults_number=2, room_number=1, page_number=0):
"""Search for available hotels"""
url = f"{BASE_URL}/v1/hotels/search"
params = {
"locale": "en-gb",
"dest_id": dest_id,
"dest_type": dest_type,
"checkin_date": checkin_date,
"checkout_date": checkout_date,
"adults_number": adults_number,
"room_number": room_number,
"page_number": page_number,
"filter_by_currency": "USD",
"order_by": "popularity",
"units": "metric"
}
response = requests.get(url, headers=headers, params=params)
return response.json()
def get_hotel_details(hotel_id):
"""Get detailed hotel information"""
url = f"{BASE_URL}/v1/hotels/data"
params = {"locale": "en-gb", "hotel_id": hotel_id}
response = requests.get(url, headers=headers, params=params)
return response.json()
def get_hotel_photos(hotel_id):
"""Get hotel photos"""
url = f"{BASE_URL}/v1/hotels/photos"
params = {"locale": "en-gb", "hotel_id": hotel_id}
response = requests.get(url, headers=headers, params=params)
return response.json()
def get_hotel_reviews(hotel_id, sort_type="SORT_MOST_RELEVANT"):
"""Get hotel reviews"""
url = f"{BASE_URL}/v1/hotels/reviews"
params = {
"locale": "en-gb",
"hotel_id": hotel_id,
"sort_type": sort_type
}
response = requests.get(url, headers=headers, params=params)
return response.json()
# ============ Main Workflow ============
if __name__ == "__main__":
# Step 1: Search for London
print("🔍 Searching for London...")
locations = search_locations("London")
london = locations[0]
print(f" Found: {london['label']}")
print(f" dest_id: {london['dest_id']}, dest_type: {london['dest_type']}")
# Step 2: Search hotels in London
print("\n🏨 Searching hotels in London...")
hotels = search_hotels(
dest_id=london['dest_id'],
dest_type=london['dest_type'],
checkin_date="2027-01-15",
checkout_date="2027-01-16"
)
# Display first 5 hotels
print(f" Found {hotels.get('count', 0)} hotels")
for hotel in hotels.get('result', [])[:5]:
print(f" - {hotel.get('hotel_name')} - ${hotel.get('min_total_price', 'N/A')}")
# Step 3: Get details for first hotel
if hotels.get('result'):
hotel_id = hotels['result'][0]['hotel_id']
print(f"\n📋 Getting details for hotel {hotel_id}...")
details = get_hotel_details(hotel_id)
print(f" Name: {details.get('name', 'N/A')}")
photos = get_hotel_photos(hotel_id)
print(f" Photos: {len(photos)} available")
reviews = get_hotel_reviews(hotel_id)
print(f" Reviews: {len(reviews.get('result', []))} fetched")JavaScript (Node.js) Example
const axios = require('axios');
// Configuration
const RAPIDAPI_KEY = 'YOUR_RAPIDAPI_KEY';
const BASE_URL = 'https://booking-com.p.rapidapi.com';
const headers = {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
};
/**
* Search for destinations by name
*/
async function searchLocations(name, locale = 'en-gb') {
const response = await axios.get(`${BASE_URL}/v1/hotels/locations`, {
headers,
params: { name, locale }
});
return response.data;
}
/**
* Search for available hotels
*/
async function searchHotels(destId, destType, checkinDate, checkoutDate,
adultsNumber = 2, roomNumber = 1, pageNumber = 0) {
const response = await axios.get(`${BASE_URL}/v1/hotels/search`, {
headers,
params: {
locale: 'en-gb',
dest_id: destId,
dest_type: destType,
checkin_date: checkinDate,
checkout_date: checkoutDate,
adults_number: adultsNumber,
room_number: roomNumber,
page_number: pageNumber,
filter_by_currency: 'USD',
order_by: 'popularity',
units: 'metric'
}
});
return response.data;
}
/**
* Get detailed hotel information
*/
async function getHotelDetails(hotelId) {
const response = await axios.get(`${BASE_URL}/v1/hotels/data`, {
headers,
params: { locale: 'en-gb', hotel_id: hotelId }
});
return response.data;
}
/**
* Get hotel photos
*/
async function getHotelPhotos(hotelId) {
const response = await axios.get(`${BASE_URL}/v1/hotels/photos`, {
headers,
params: { locale: 'en-gb', hotel_id: hotelId }
});
return response.data;
}
/**
* Get hotel reviews
*/
async function getHotelReviews(hotelId, sortType = 'SORT_MOST_RELEVANT') {
const response = await axios.get(`${BASE_URL}/v1/hotels/reviews`, {
headers,
params: {
locale: 'en-gb',
hotel_id: hotelId,
sort_type: sortType
}
});
return response.data;
}
// ============ Main Workflow ============
async function main() {
try {
// Step 1: Search for London
console.log('🔍 Searching for London...');
const locations = await searchLocations('London');
const london = locations[0];
console.log(` Found: ${london.label}`);
console.log(` dest_id: ${london.dest_id}, dest_type: ${london.dest_type}`);
// Step 2: Search hotels in London
console.log('\n🏨 Searching hotels in London...');
const hotels = await searchHotels(
london.dest_id,
london.dest_type,
'2027-01-15',
'2027-01-16'
);
// Display first 5 hotels
console.log(` Found ${hotels.count || 0} hotels`);
(hotels.result || []).slice(0, 5).forEach(hotel => {
console.log(` - ${hotel.hotel_name} - $${hotel.min_total_price || 'N/A'}`);
});
// Step 3: Get details for first hotel
if (hotels.result && hotels.result.length > 0) {
const hotelId = hotels.result[0].hotel_id;
console.log(`\n📋 Getting details for hotel ${hotelId}...`);
const details = await getHotelDetails(hotelId);
console.log(` Name: ${details.name || 'N/A'}`);
const photos = await getHotelPhotos(hotelId);
console.log(` Photos: ${photos.length} available`);
const reviews = await getHotelReviews(hotelId);
console.log(` Reviews: ${(reviews.result || []).length} fetched`);
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
main();JavaScript (Browser/Fetch) Example
// Configuration
const RAPIDAPI_KEY = 'YOUR_RAPIDAPI_KEY';
const BASE_URL = 'https://booking-com.p.rapidapi.com';
/**
* Make API request
*/
async function apiRequest(endpoint, params) {
const queryString = new URLSearchParams(params).toString();
const response = await fetch(`${BASE_URL}${endpoint}?${queryString}`, {
method: 'GET',
headers: {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
}
/**
* Complete hotel search workflow
*/
async function searchAndDisplayHotels(cityName, checkin, checkout) {
try {
// Step 1: Find destination
console.log(`Searching for ${cityName}...`);
const locations = await apiRequest('/v1/hotels/locations', {
name: cityName,
locale: 'en-gb'
});
if (!locations.length) {
console.log('Location not found');
return;
}
const destination = locations[0];
console.log(`Found: ${destination.label}`);
// Step 2: Search hotels
const hotels = await apiRequest('/v1/hotels/search', {
locale: 'en-gb',
dest_id: destination.dest_id,
dest_type: destination.dest_type,
checkin_date: checkin,
checkout_date: checkout,
adults_number: 2,
room_number: 1,
filter_by_currency: 'USD',
order_by: 'popularity',
units: 'metric'
});
// Display results
console.log(`\nFound ${hotels.count} hotels:`);
hotels.result.slice(0, 10).forEach((hotel, index) => {
console.log(`${index + 1}. ${hotel.hotel_name}`);
console.log(` Price: $${hotel.min_total_price}`);
console.log(` Rating: ${hotel.review_score}/10`);
console.log(` Distance: ${hotel.distance_to_cc} km from center`);
});
return hotels;
} catch (error) {
console.error('Error:', error);
}
}
// Usage
searchAndDisplayHotels('Paris', '2027-01-01', '2027-01-03');Example 2: Search Hotels by Coordinates
Python Example
import requests
RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
BASE_URL = "https://booking-com.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
def search_hotels_by_coordinates(latitude, longitude, checkin_date, checkout_date,
adults_number=2, room_number=1):
"""Search hotels near specific coordinates"""
url = f"{BASE_URL}/v1/hotels/search-by-coordinates"
params = {
"locale": "en-gb",
"latitude": latitude,
"longitude": longitude,
"checkin_date": checkin_date,
"checkout_date": checkout_date,
"adults_number": adults_number,
"room_number": room_number,
"filter_by_currency": "USD",
"order_by": "distance",
"units": "metric"
}
response = requests.get(url, headers=headers, params=params)
return response.json()
# ============ Main ============
if __name__ == "__main__":
# Search hotels near Eiffel Tower, Paris
print("🏨 Searching hotels near Eiffel Tower, Paris...")
hotels = search_hotels_by_coordinates(
latitude=48.8584,
longitude=2.2945,
checkin_date="2027-01-15",
checkout_date="2027-01-16"
)
print(f"Found {hotels.get('count', 0)} hotels nearby:")
for hotel in hotels.get('result', [])[:5]:
print(f" - {hotel.get('hotel_name')}")
print(f" Distance: {hotel.get('distance_to_cc')} km")
print(f" Price: ${hotel.get('min_total_price')}")JavaScript Example
const axios = require('axios');
const RAPIDAPI_KEY = 'YOUR_RAPIDAPI_KEY';
const BASE_URL = 'https://booking-com.p.rapidapi.com';
/**
* Search hotels near specific coordinates
*/
async function searchHotelsByCoordinates(latitude, longitude, checkinDate, checkoutDate,
adultsNumber = 2, roomNumber = 1) {
const response = await axios.get(`${BASE_URL}/v1/hotels/search-by-coordinates`, {
headers: {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
},
params: {
locale: 'en-gb',
latitude,
longitude,
checkin_date: checkinDate,
checkout_date: checkoutDate,
adults_number: adultsNumber,
room_number: roomNumber,
filter_by_currency: 'USD',
order_by: 'distance',
units: 'metric'
}
});
return response.data;
}
// ============ Main ============
async function main() {
// Search hotels near Times Square, New York
console.log('🏨 Searching hotels near Times Square, New York...');
const hotels = await searchHotelsByCoordinates(
40.7580, // Latitude
-73.9855, // Longitude
'2027-01-15',
'2027-01-16'
);
console.log(`Found ${hotels.count || 0} hotels nearby:`);
(hotels.result || []).slice(0, 5).forEach(hotel => {
console.log(` - ${hotel.hotel_name}`);
console.log(` Distance: ${hotel.distance_to_cc} km`);
console.log(` Price: $${hotel.min_total_price}`);
});
}
main().catch(console.error);Example 3: Car Rental Search
Python Example
import requests
RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
BASE_URL = "https://booking-com.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
def search_car_locations(name):
"""Search car rental locations"""
url = f"{BASE_URL}/v1/car-rental/locations"
params = {"locale": "en-gb", "name": name}
response = requests.get(url, headers=headers, params=params)
return response.json()
def search_car_rental(pickup_lat, pickup_lng, pickup_datetime,
dropoff_lat, dropoff_lng, dropoff_datetime,
from_country="de"):
"""Search available rental cars"""
url = f"{BASE_URL}/v1/car-rental/search"
params = {
"locale": "en-gb",
"currency": "USD",
"sort_by": "price_low_to_high",
"from_country": from_country,
"pick_up_latitude": pickup_lat,
"pick_up_longitude": pickup_lng,
"pick_up_datetime": pickup_datetime,
"drop_off_latitude": dropoff_lat,
"drop_off_longitude": dropoff_lng,
"drop_off_datetime": dropoff_datetime
}
response = requests.get(url, headers=headers, params=params)
return response.json()
def get_car_details(vehicle_id, search_key, from_country="de"):
"""Get car rental details"""
url = f"{BASE_URL}/v1/car-rental/detail"
params = {
"locale": "en-gb",
"currency": "USD",
"from_country": from_country,
"vehicle_id": vehicle_id,
"search_key": search_key
}
response = requests.get(url, headers=headers, params=params)
return response.json()
# ============ Main ============
if __name__ == "__main__":
# Step 1: Find location
print("🚗 Searching car rental locations in Berlin...")
locations = search_car_locations("Berlin")
if locations:
print(f" Found: {locations[0].get('label', 'N/A')}")
# Step 2: Search available cars
print("\n🚙 Searching available cars...")
cars = search_car_rental(
pickup_lat=52.52,
pickup_lng=13.405,
pickup_datetime="2027-01-15 10:00:00",
dropoff_lat=52.52,
dropoff_lng=13.405,
dropoff_datetime="2027-01-16 10:00:00",
from_country="de"
)
print(f" Found {len(cars.get('result', []))} cars:")
for car in cars.get('result', [])[:5]:
print(f" - {car.get('vehicle_type', {}).get('name', 'Unknown')}")
print(f" Price: ${car.get('price', 'N/A')}")
print(f" Supplier: {car.get('supplier', {}).get('name', 'N/A')}")JavaScript Example
const axios = require('axios');
const RAPIDAPI_KEY = 'YOUR_RAPIDAPI_KEY';
const BASE_URL = 'https://booking-com.p.rapidapi.com';
/**
* Search car rental locations
*/
async function searchCarLocations(name) {
const response = await axios.get(`${BASE_URL}/v1/car-rental/locations`, {
headers: {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
},
params: { locale: 'en-gb', name }
});
return response.data;
}
/**
* Search available rental cars
*/
async function searchCarRental(pickupLat, pickupLng, pickupDatetime,
dropoffLat, dropoffLng, dropoffDatetime,
fromCountry = 'de') {
const response = await axios.get(`${BASE_URL}/v1/car-rental/search`, {
headers: {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
},
params: {
locale: 'en-gb',
currency: 'USD',
sort_by: 'price_low_to_high',
from_country: fromCountry,
pick_up_latitude: pickupLat,
pick_up_longitude: pickupLng,
pick_up_datetime: pickupDatetime,
drop_off_latitude: dropoffLat,
drop_off_longitude: dropoffLng,
drop_off_datetime: dropoffDatetime
}
});
return response.data;
}
// ============ Main ============
async function main() {
// Step 1: Find location
console.log('🚗 Searching car rental locations in Berlin...');
const locations = await searchCarLocations('Berlin');
if (locations.length > 0) {
console.log(` Found: ${locations[0].label || 'N/A'}`);
}
// Step 2: Search available cars
console.log('\n🚙 Searching available cars...');
const cars = await searchCarRental(
52.52, 13.405, // Berlin coordinates
'2027-01-15 10:00:00', // Pickup
52.52, 13.405, // Same drop-off
'2027-01-16 10:00:00', // Dropoff
'de'
);
console.log(` Found ${(cars.result || []).length} cars:`);
(cars.result || []).slice(0, 5).forEach(car => {
console.log(` - ${car.vehicle_type?.name || 'Unknown'}`);
console.log(` Price: $${car.price || 'N/A'}`);
console.log(` Supplier: ${car.supplier?.name || 'N/A'}`);
});
}
main().catch(console.error);Example 4: Complete Hotel Information with Filters
Python Example
import requests
RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
BASE_URL = "https://booking-com.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
class BookingAPI:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = "https://booking-com.p.rapidapi.com"
self.headers = {
"X-RapidAPI-Key": api_key,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
def _get(self, endpoint, params):
"""Make GET request"""
url = f"{self.base_url}{endpoint}"
response = requests.get(url, headers=self.headers, params=params)
response.raise_for_status()
return response.json()
def search_locations(self, name, locale="en-gb"):
return self._get("/v1/hotels/locations", {"name": name, "locale": locale})
def get_search_filters(self, dest_id, dest_type, checkin, checkout):
return self._get("/v1/hotels/search-filters", {
"locale": "en-gb",
"dest_id": dest_id,
"dest_type": dest_type,
"checkin_date": checkin,
"checkout_date": checkout,
"room_number": 1,
"adults_number": 2,
"filter_by_currency": "USD",
"order_by": "popularity",
"units": "metric"
})
def search_hotels(self, dest_id, dest_type, checkin, checkout,
filters=None, page=0):
params = {
"locale": "en-gb",
"dest_id": dest_id,
"dest_type": dest_type,
"checkin_date": checkin,
"checkout_date": checkout,
"room_number": 1,
"adults_number": 2,
"page_number": page,
"filter_by_currency": "USD",
"order_by": "review_score",
"units": "metric"
}
if filters:
params["categories_filter_ids"] = filters
return self._get("/v1/hotels/search", params)
def get_hotel_full_info(self, hotel_id):
"""Get comprehensive hotel information"""
info = {}
# Basic data
info['data'] = self._get("/v1/hotels/data",
{"locale": "en-gb", "hotel_id": hotel_id})
# Photos
info['photos'] = self._get("/v1/hotels/photos",
{"locale": "en-gb", "hotel_id": hotel_id})
# Facilities
info['facilities'] = self._get("/v1/hotels/facilities",
{"locale": "en-gb", "hotel_id": hotel_id})
# Reviews
info['reviews'] = self._get("/v1/hotels/reviews", {
"locale": "en-gb",
"hotel_id": hotel_id,
"sort_type": "SORT_MOST_RELEVANT"
})
# Policies
info['policies'] = self._get("/v1/hotels/policies",
{"locale": "en-gb", "hotel_id": hotel_id})
return info
# ============ Main ============
if __name__ == "__main__":
api = BookingAPI(RAPIDAPI_KEY)
# Search destination
print("🔍 Searching for Barcelona...")
locations = api.search_locations("Barcelona")
dest = locations[0]
print(f" Found: {dest['label']}")
# Get available filters
print("\n📊 Getting search filters...")
filters = api.get_search_filters(
dest['dest_id'], dest['dest_type'],
"2027-01-01", "2027-01-03"
)
print(f" Available filter categories: {len(filters)}")
# Search with filters (4-star hotels with free cancellation)
print("\n🏨 Searching 4-star hotels with free cancellation...")
hotels = api.search_hotels(
dest['dest_id'], dest['dest_type'],
"2027-01-01", "2027-01-03",
filters="class::4,free_cancellation::1"
)
print(f" Found {hotels.get('count', 0)} hotels")
for h in hotels.get('result', [])[:3]:
print(f" - {h.get('hotel_name')} (Rating: {h.get('review_score')})")
# Get full info for top hotel
if hotels.get('result'):
hotel_id = hotels['result'][0]['hotel_id']
print(f"\n📋 Getting full info for hotel {hotel_id}...")
full_info = api.get_hotel_full_info(hotel_id)
print(f" Name: {full_info['data'].get('name')}")
print(f" Photos: {len(full_info['photos'])}")
print(f" Facilities: {len(full_info['facilities'])}")
print(f" Reviews: {len(full_info['reviews'].get('result', []))}")Example 5: Pagination Helper
Python Example
import requests
from typing import List, Dict, Any
RAPIDAPI_KEY = "YOUR_RAPIDAPI_KEY"
BASE_URL = "https://booking-com.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": "booking-com.p.rapidapi.com"
}
def get_all_hotels(dest_id, dest_type, checkin, checkout,
max_pages=10) -> List[Dict[str, Any]]:
"""Fetch all hotels using pagination"""
all_hotels = []
page = 0
while page < max_pages:
url = f"{BASE_URL}/v1/hotels/search"
params = {
"locale": "en-gb",
"dest_id": dest_id,
"dest_type": dest_type,
"checkin_date": checkin,
"checkout_date": checkout,
"room_number": 1,
"adults_number": 2,
"page_number": page,
"filter_by_currency": "USD",
"order_by": "popularity",
"units": "metric"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
hotels = data.get('result', [])
if not hotels:
break
all_hotels.extend(hotels)
print(f"Page {page}: {len(hotels)} hotels (Total: {len(all_hotels)})")
page += 1
return all_hotels
# Usage
if __name__ == "__main__":
# Get all hotels in Amsterdam (first 5 pages)
hotels = get_all_hotels(
dest_id="-2140479", # Amsterdam
dest_type="city",
checkin="2027-01-01",
checkout="2027-01-03",
max_pages=5
)
print(f"\nTotal hotels collected: {len(hotels)}")
# Sort by price
sorted_hotels = sorted(
[h for h in hotels if h.get('min_total_price')],
key=lambda x: x['min_total_price']
)
print("\nTop 5 cheapest hotels:")
for h in sorted_hotels[:5]:
print(f" {h['hotel_name']}: ${h['min_total_price']}")JavaScript Example
const axios = require('axios');
const RAPIDAPI_KEY = 'YOUR_RAPIDAPI_KEY';
const BASE_URL = 'https://booking-com.p.rapidapi.com';
/**
* Fetch all hotels using pagination
*/
async function getAllHotels(destId, destType, checkin, checkout, maxPages = 10) {
const allHotels = [];
let page = 0;
while (page < maxPages) {
try {
const response = await axios.get(`${BASE_URL}/v1/hotels/search`, {
headers: {
'X-RapidAPI-Key': RAPIDAPI_KEY,
'X-RapidAPI-Host': 'booking-com.p.rapidapi.com'
},
params: {
locale: 'en-gb',
dest_id: destId,
dest_type: destType,
checkin_date: checkin,
checkout_date: checkout,
room_number: 1,
adults_number: 2,
page_number: page,
filter_by_currency: 'USD',
order_by: 'popularity',
units: 'metric'
}
});
const hotels = response.data.result || [];
if (hotels.length === 0) break;
allHotels.push(...hotels);
console.log(`Page ${page}: ${hotels.length} hotels (Total: ${allHotels.length})`);
page++;
} catch (error) {
console.error(`Error on page ${page}:`, error.message);
break;
}
}
return allHotels;
}
// Usage
async function main() {
const hotels = await getAllHotels(
'-2140479', // Amsterdam
'city',
'2027-01-01',
'2027-01-03',
5 // max pages
);
console.log(`\nTotal hotels collected: ${hotels.length}`);
// Sort by price
const sorted = hotels
.filter(h => h.min_total_price)
.sort((a, b) => a.min_total_price - b.min_total_price);
console.log('\nTop 5 cheapest hotels:');
sorted.slice(0, 5).forEach(h => {
console.log(` ${h.hotel_name}: $${h.min_total_price}`);
});
}
main().catch(console.error);FAQ
How to search for the nearest hotels by coordinates?
Use the Search hotels by coordinates endpoint:
GET /v1/hotels/search-by-coordinates?latitude=51.5074&longitude=-0.1278&...Does the API provide online booking and cancellation?
The API allows you to find hotels and rooms, then get a booking link to complete the reservation on Booking com:
https://secure.booking.com/book.html?hotel_id=7292334&checkin=2021-09-14&interval=2&stage=1&nr_rooms_729233401_325315371_3_0_0=1Why doesn't currency filtering work correctly?
Prices and currency filters are always in the hotel's local currency. For example, if the hotel operates in Euros, prices will be displayed in Euros regardless of the currency parameter.
How do I paginate results?
Use the page_number parameter to navigate through result pages. Start with page_number=0 and increment for subsequent pages.
Support
- Email: tipsters@rapi.one
- Telegram: https://t.me/api_tipsters
- Other Travel APIs: https://rapi.one/travel/
- OpenAPI Specification: https://hugeapi.com/collection/booking-com