Booking Hotel Async API
Submit Booking hotel URLs and retrieve structured hotel records asynchronously.
To enable this type, set the engine=booking_async and type=hotel parameters.
Scrape Booking hotels data and get real-time, accurate results without worrying about website restrictions. Submit hotel URLs with a POST request, then use the returned snapshot_id to retrieve the processed records from the Snapshot API.
Booking Hotel API Integration Examples
We will use the following URL for the POST request:
https://ecom.webscrapingapi.com/v1?engine=booking_async&api_key=<YOUR_API_KEY>&type=hotelWe will use this body for the POST request:
[
{
"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"
},
{
"url": "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"
}
]Ready to Use Booking Hotel Scraping Scripts
curl --request POST "https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=hotel" \
--header "Content-Type: application/json" \
--data '[
{
"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"
},
{
"url": "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"
}
]'const API_KEY = "<YOUR_API_KEY>";
const SCRAPER_URL = "https://ecom.webscrapingapi.com/v1";
const params = new URLSearchParams({
api_key: API_KEY,
engine: "booking_async",
type: "hotel",
});
const response = await fetch(`${SCRAPER_URL}?${params}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify([
{ url: "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main" },
{ url: "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html" },
]),
});
const data = await response.json();
console.log(data.snapshot_id);import requests
API_KEY = "<YOUR_API_KEY>"
SCRAPER_URL = "https://ecom.webscrapingapi.com/v1"
PARAMS = {
"api_key": API_KEY,
"engine": "booking_async",
"type": "hotel",
}
PAYLOAD = [
{"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"},
{"url": "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"},
]
response = requests.post(SCRAPER_URL, params=PARAMS, json=PAYLOAD)
response.raise_for_status()
print(response.json()["snapshot_id"])<?php
$apiKey = '<YOUR_API_KEY>';
$scraperUrl = 'https://ecom.webscrapingapi.com/v1';
$query = http_build_query([
'api_key' => $apiKey,
'engine' => 'booking_async',
'type' => 'hotel',
]);
$payload = json_encode([
['url' => 'https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main'],
['url' => 'https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html'],
]);
$context = stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => $payload,
],
]);
$response = file_get_contents("{$scraperUrl}?{$query}", false, $context);
echo $response;package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=hotel"
payload := []byte(`[
{"url":"https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"},
{"url":"https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"}
]`)
req, _ := http.NewRequest("POST", url, bytes.NewReader(payload))
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
[
{"url":"https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"},
{"url":"https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"}
]
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=hotel"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=hotel";
var payload = """
[
{"url":"https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"},
{"url":"https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"}
]
""";
using var client = new HttpClient();
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
}require "json"
require "net/http"
require "uri"
uri = URI("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=hotel")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request.body = [
{ url: "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main" },
{ url: "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html" },
].to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.bodyOnce you send the POST request with the required parameters, the API will process your request and return a snapshot_id, which can be used to fetch the results via the Snapshot API.
Response example
{
"snapshot_id": "s_m4x7enmven8djfqak"
}Retrieving Results Using the Snapshot API
Once you've submitted a POST request to the Booking API and received a snapshot_id, you can use the Snapshot API to retrieve the processed results.
https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&snapshot_id=s_m4x7enmven8djfqakResult response example
{
"0": {
"input": {
"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html#tab-main"
},
"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html",
"name": "Westlands of Pitlochry",
"address": "160 Atholl Road, Pitlochry",
"rating": 9.1,
"review_count": 2093
}
}