# Booking.com Calendar Scraper (Spain, Availability and Prices) (`steadfetch/booking-calendar-scraper`) Actor

Calendar snapshot of the Booking.com listings of a Spanish municipality: availability and approximate nightly price for up to 12 months, one row per listing. Public pages only, no login. Whoever runs it is responsible for complying with the Booking.com terms of use.

- **URL**: https://apify.com/steadfetch/booking-calendar-scraper.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** Travel, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 result delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

Calendar snapshot of the Booking.com listings of one Spanish municipality: for each listing, whether every night of the next months can be booked and the approximate price per night that Booking shows for it. One row per listing, in the calendar snapshot format that `rental-calendar-monitor` compares. Development steps and the publishing checklist live in [PUBLISHING.md](PUBLISHING.md).

Whoever runs this Actor is responsible for complying with the Booking.com terms of use. It reads public pages only, without login or account cookies.

### What it does

- Takes the five-digit INE code of a Spanish municipality (`"03047"` is Calp) and looks it up in the bundled municipality table (INE names, IGN boxes).
- Finds the municipality's destination on Booking.com with Booking's own search-box suggestions for the municipality name (for a bilingual municipality, each official name in turn): among the suggestions that are a Spanish city inside the municipality box, it takes the one nearest the municipality's reference point, and only if it is within a quarter of the box diagonal (at least 5 km); never a region, district, airport or hotel. If no suggestion fits, the run ends with an error that lists the suggestions seen and delivers nothing.
- Walks Booking's result list for that destination in its own order, 25 listings per request.
- Keeps only the listings that belong to the municipality: their coordinates must fall inside the municipality box, and they must carry the Booking city id that dominates inside that box. A neighbouring town that Booking mixes into the results is never delivered. If the destination's listings lie elsewhere, the run ends with an error and delivers nothing; if Booking has no listing there at all, it delivers zero rows with a warning.
- For each listing, reads the availability calendar Booking shows in its date picker, 61 days per request, up to 12 months (6 requests per listing), and delivers one row with one entry per night from the run day (UTC): `available`, `price` (approximate price per night in EUR, rounded to the euro by Booking) and `minNights`.
- Nights without a price (Booking shows `0` for nights that are not available) get `price: null`, never 0. A missing part of the calendar is left out, never invented.
- Waits at least 2.1 seconds between any two of its own requests. No input changes that pace.
- Saves the record `CONTINUATION` in the run's key-value store: `{ "nextOffset": <n or null>, "totalSeen": <n> }`. Run again with `offset: nextOffset` to continue; `null` means Booking's list has no more listings.

#### Headless browser

The Actor uses one headless Chromium tab (Playwright). It loads Booking's front page, asks the search-box suggestions once per run (one request per official name tried), loads the results page of the destination, and reads the list and the calendars from that page: three kinds of GraphQL queries to the same Booking endpoint. It never opens the page of each listing. A browser takes more compute than a plain HTTP Actor; that cost is part of the price below. How each field is read is in [docs/data-map.md](docs/data-map.md).

### How to use

```bash
apify call steadfetch/booking-calendar-scraper --input='{"municipalityCode":"03047","maxListings":25}'
```

Then read the rows from the run's default dataset and the `CONTINUATION` record from its key-value store.

#### Minimum input

Three listings of Calp, 12 months each. It is the declared `exampleRunInput`:

```json
{
  "municipalityCode": "03047",
  "maxListings": 3
}
```

#### Input fields

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `municipalityCode` | string | Yes | - | Five-digit INE code, as a string (`"03047"`, `"29067"`). A number, a short or unknown code fails the run before any request, naming the value. |
| `months` | integer | No | 12 | Months of calendar per listing, 1 to 12. 12 gives 365 days. |
| `maxListings` | integer | No | 25 | Listings delivered in this run, 1 to 500. 500 is a fixed cap per run. |
| `offset` | integer | No | 0 | Places of Booking's result list to skip. Use `nextOffset` of the previous run's `CONTINUATION`. |
| `adults` | integer | No | 2 | Adults the nightly price is quoted for, one room. |
| `propertyType` | string | No | `all` | `all`, `apartments` (Booking type 201) or `hotels` (Booking type 204). |

`offset`, `nextOffset` and `totalSeen` count places in Booking's result list for the search, including listings skipped because they are outside the municipality. `totalSeen` is the number of places passed so far, the skipped offset included.

### Output

#### Example output

One row (calendar shortened to three nights):

```json
{
  "url": "https://www.booking.com/hotel/es/apartamento-frente-al-mar-en-calpe-para-4-personas.html",
  "title": "Apartamento frente al mar en Calpe para 4 personas",
  "scrapedAt": "2026-11-16T10:00:00.000Z",
  "source": "booking",
  "municipalityCode": "03047",
  "municipalityName": "Calp",
  "listingId": "7013095",
  "propertyType": "apartment",
  "capacity": null,
  "rating": 8.8,
  "reviewCount": 62,
  "lat": 38.642,
  "lon": 0.055,
  "currency": "EUR",
  "calendar": [
    { "date": "2026-11-16", "available": false, "price": null, "minNights": 1 },
    { "date": "2026-11-17", "available": true, "price": 89, "minNights": 3 },
    { "date": "2026-11-18", "available": true, "price": 101, "minNights": 1 }
  ]
}
```

#### Output fields

| Field | Type | Description |
| --- | --- | --- |
| `url` | string | Public Booking.com page of the listing. |
| `title` | string or null | Listing name as Booking shows it. |
| `scrapedAt` | date-time | When this listing's calendar was read (UTC, ends in `Z`). |
| `source` | string | Always `booking`. |
| `municipalityCode` | string | Five-digit INE code. |
| `municipalityName` | string | Official INE name. |
| `listingId` | string | Booking property ID, stable between runs. |
| `propertyType` | string or null | `apartment`, `hotel`, `aparthotel`, `holiday_home`, `villa`, `guest_house`, `bed_and_breakfast`, `hostel`, `homestay`, `country_house`, `campsite`, `tented_camp`, `chalet`, or `ht_<id>` for another Booking type id. |
| `capacity` | null | Always null: Booking does not give the number of guests without opening each listing page. |
| `rating` | number or null | Booking review score (0 to 10); null without reviews. |
| `reviewCount` | integer or null | Number of Booking reviews. |
| `lat`, `lon` | number or null | Rounded to 3 decimals (about 100 m), never the exact address. |
| `currency` | string | Always `EUR`. |
| `calendar` | array | One entry per night from the run day, ascending, no repeated dates, at most 365: `date`, `available`, `price` (EUR or null), `minNights` (or null). |

The row is exactly the `CalendarSnapshotItem` contract of `rental-calendar-monitor`: two runs of this Actor some days apart are two snapshots it can compare. No host names and no addresses are ever delivered.

#### Limits

- The price is Booking's "approximate price" per night for the date picker, for the adults asked and one room. In hotels it is a price per room type, not the price of a specific booking.
- If the website stops answering with data, the run stops: the rows already delivered stay in the dataset, and `CONTINUATION` notes where to continue (the first listing not delivered). The same happens when the first three listings tried, or more, all come without any calendar day.
- A listing with 12 months takes about 13 seconds, so 500 listings take close to 2 hours: give the run a timeout that long. When the run timeout is less than 90 seconds away, the Actor starts no new listing, saves `CONTINUATION` and ends normally.
- If the Booking answer changes shape (a missing field path), the run stops with an error that names the query and the path, and delivers no row with empty fields.

### Pricing

Pay-per-event with the two synthetic platform events: `apify-actor-start` at 0.00005 USD per run (Apify-recommended default, includes the first 5 seconds of compute) and `apify-default-dataset-item` at 5.00 USD per 1,000 results (0.005 USD per result), one result per listing delivered with its calendar. Nothing is charged per request or per check: this Actor does not use the `monitor-check` event, and there is no `Actor.charge()` call, so users are never billed twice. Steadfetch keeps result prices between 1 and 10 USD per 1,000 results.

Cost behind the price: the pace (2.1 seconds between requests, 6 calendar requests per listing for 12 months) makes a listing take about 13 seconds of run time. The pre-launch test on Apify, with the same requests at 2,048 MB, measured about 0.0014 USD of platform compute per listing for 12 months. The browser is most of the memory.

**Works on the Apify free plan** - about 999 results for the $5 monthly credit (5.00 USD minus the 0.00005 USD run-start event, at 0.005 USD per result).

### FAQ

**Who answers for the Booking.com terms?** Whoever runs the Actor. Booking.com's terms of use restrict automated access to its platform; read them before you run it. Steadfetch withdraws the Actor within 48 hours of a complaint from the platform.

**Why do some listings of the municipality not appear?** The Actor keeps a listing only when its coordinates fall inside the municipality box and it carries the Booking city id that dominates inside the box. Listings that Booking files under another town are left out on purpose, so no row belongs to another municipality.

**How do I get every listing of a large municipality?** Run it several times, each with the previous run's `CONTINUATION.nextOffset` as `offset`, until `nextOffset` is `null`.

**Why is `capacity` always null?** Booking gives it only on the page of each listing or in a search with dates; this Actor reads neither.

**Is there personal data in the output?** No host names, no authors, no addresses. Coordinates are rounded to about 100 m.

**When am I charged?** Once per run start (`apify-actor-start`) and once per listing saved (`apify-default-dataset-item`). A run that stops early keeps, and charges, only the listings it delivered.

### Support

Report bugs or request features through the Apify Store page (Issues tab) of this Actor, or through the Steadfetch actors repository issues. Include the run ID and the input used.

### Maintenance

This Actor is **tested daily**: the monorepo CI runs `npm test` (parsing of saved Booking answers, the municipality filter, the calendar merge, resuming and the request pace, all offline) and the shared publish gate on every push, and the daily catalog QA runs the `{"municipalityCode":"03047","maxListings":3}` input once it is published. Schema changes are announced through repository releases.

Local development runs need the Chromium build of Playwright 1.65.1; another Chromium can be given in the `BROWSER_EXECUTABLE_PATH` environment variable. The Docker image already has the right one.

Data sources of the municipality table: INE (CC BY 4.0, "Fuente: INE, www.ine.es") and Instituto Geografico Nacional (IGN), BDLJE, CC BY 4.0, via Opendatasoft.

# Actor input Schema

## `municipalityCode` (type: `string`):

Five-digit INE code of the Spanish municipality, as a string. Example: "03047" for Calp (Alicante), "29067" for Malaga. Listings whose coordinates fall outside the municipality are never delivered.

## `months` (type: `integer`):

How many months of calendar to read for each listing, from the run day (UTC). 12 gives 365 days. Booking answers 61 days per request, so 12 months take 6 requests per listing.

## `maxListings` (type: `integer`):

Maximum number of listings delivered in this run. Fixed cap: 500 per run. Each listing is one result.

## `offset` (type: `integer`):

How many places of Booking's result list to skip before starting. To continue a previous run, use the nextOffset saved in its key-value store record CONTINUATION.

## `adults` (type: `integer`):

Number of adults the nightly price is quoted for (one room).

## `propertyType` (type: `string`):

Which Booking listings to read: all of them, only apartments (Booking type 201) or only hotels (Booking type 204).

## `proxyConfiguration` (type: `object`):

Optional. By default the Actor uses no proxy.

## Actor input object example

```json
{
  "municipalityCode": "03047",
  "months": 12,
  "maxListings": 25,
  "offset": 0,
  "adults": 2,
  "propertyType": "apartments"
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items validated against the item schema in dataset_schema.json (fields).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "municipalityCode": "03047",
    "maxListings": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/booking-calendar-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "municipalityCode": "03047",
    "maxListings": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/booking-calendar-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "municipalityCode": "03047",
  "maxListings": 3
}' |
apify call steadfetch/booking-calendar-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/booking-calendar-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/xWnZKutmEICLfQMMd/builds/cWWvUwWcCYhTuLl2s/openapi.json
