Access the API
Submit Booking API jobs and poll finished snapshots.
The Booking API is available through asynchronous POST requests sent to the e-commerce API endpoint. Submit a job with engine=booking_async and a Booking type, then poll the returned snapshot_id.
The official Booking API endpoint is:
https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=<BOOKING_TYPE>Making a POST request
When making a POST request, include the following components:
- API Key: Add your unique API key as a query parameter in the URL:
https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=booking_async&type=<BOOKING_TYPE> - Type Selection: Specify the type you want to scrape. Supported types are
hotelandsearch. - Request Body: The body must be a JSON array of input objects for the selected Booking type. For hotel details, send Booking hotel URLs:
[
{
"url": "https://www.booking.com/hotel/gb/westlands-of-pitlochry.en-gb.html"
},
{
"url": "https://www.booking.com/hotel/fr/du-midi-paris.en-gb.html"
}
]After submitting a POST request, you will receive a snapshot_id in the response. This snapshot_id can be used to retrieve the processed results at a later time.
Accessing the snapshot API
The Snapshot API allows you to retrieve results from a previously submitted POST request using the snapshot_id. This feature is useful for asynchronous processing and ensures that you can access data when it is ready.
Snapshot API Endpoint
https://ecom.webscrapingapi.com/v1Required Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
api_key | ✅ | string | Your unique API key. |
snapshot_id | ✅ | string | The ID returned from the submit request. |
Example GET Request
curl --get "https://ecom.webscrapingapi.com/v1" \
--data-urlencode "api_key=<YOUR_API_KEY>" \
--data-urlencode "snapshot_id=<SNAPSHOT_ID>"const API_KEY = "<YOUR_API_KEY>";
const SNAPSHOT_ID = "<SNAPSHOT_ID>";
const API_URL = "https://ecom.webscrapingapi.com/v1";
const params = new URLSearchParams({
api_key: API_KEY,
snapshot_id: SNAPSHOT_ID,
});
const response = await fetch(`${API_URL}?${params}`);
const data = await response.json();
console.log(data);import requests
api_key = "<YOUR_API_KEY>"
snapshot_id = "<SNAPSHOT_ID>"
response = requests.get(
"https://ecom.webscrapingapi.com/v1",
params={
"api_key": api_key,
"snapshot_id": snapshot_id,
},
)
print(response.json())<?php
$apiKey = '<YOUR_API_KEY>';
$snapshotId = '<SNAPSHOT_ID>';
$query = http_build_query([
'api_key' => $apiKey,
'snapshot_id' => $snapshotId,
]);
$response = file_get_contents("https://ecom.webscrapingapi.com/v1?$query");
echo $response;package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
params := url.Values{}
params.Add("api_key", "<YOUR_API_KEY>")
params.Add("snapshot_id", "<SNAPSHOT_ID>")
requestURL := "https://ecom.webscrapingapi.com/v1?" + params.Encode()
response, err := http.Get(requestURL)
if err != nil {
panic(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
String apiKey = "<YOUR_API_KEY>";
String snapshotId = "<SNAPSHOT_ID>";
String requestUrl = "https://ecom.webscrapingapi.com/v1"
+ "?api_key=" + URLEncoder.encode(apiKey, StandardCharsets.UTF_8)
+ "&snapshot_id=" + URLEncoder.encode(snapshotId, StandardCharsets.UTF_8);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(requestUrl))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var apiKey = "<YOUR_API_KEY>";
var snapshotId = "<SNAPSHOT_ID>";
var requestUrl = $"https://ecom.webscrapingapi.com/v1?api_key={Uri.EscapeDataString(apiKey)}&snapshot_id={Uri.EscapeDataString(snapshotId)}";
using var client = new HttpClient();
var response = await client.GetStringAsync(requestUrl);
Console.WriteLine(response);
}
}require "net/http"
require "uri"
uri = URI("https://ecom.webscrapingapi.com/v1")
uri.query = URI.encode_www_form(
api_key: "<YOUR_API_KEY>",
snapshot_id: "<SNAPSHOT_ID>"
)
response = Net::HTTP.get(uri)
puts responseThe response will include the results associated with the snapshot_id in JSON format.
The API Key
Our Booking API requires an API key for authentication. The key is passed as the api_key query parameter on submit and poll requests. Missing or invalid keys return an Unauthorized HTTP status.
To obtain an API key for the Booking API, you have to:
- Register a new account on our official platform
- Get access to this service upon request
Keep API keys in server-side secrets. Do not ship them in browser code, mobile apps, public repositories, logs, screenshots, or shared notebooks.