100 free credits. No credit card required. Get a key

How to scrape rooms and prices of a Booking.com property for a stay with PHP

A Booking.com property’s room types for a stay, with the best available price and nightly prices.

The examples use PHP’s curl extension and json_decode(..., true), so the response is a plain associative array. No Composer packages needed.

GET /v1/booking/hotel/rooms2 credits per callRefunded on failureBeta

Before you start

  1. Get an API keySign up for 100 free credits, no card. Keys start with gs_live_.
  2. Put it in the environmentEvery example reads it from GROUNDSOCIAL_API_KEY: export GROUNDSOCIAL_API_KEY=gs_live_…
  3. Set up PHPphp -m | grep curl # the curl extension ships with most PHP builds

Call Rooms and prices of a Booking.com property for a stay API from PHP

GET /v1/booking/hotel/rooms. Save this as main.php and run php main.php. It reads the items in rooms and prints id for each.

main.php
<?php

function groundsocial(string $path, array $params = []): array
{
    $url = 'https://api.groundsocial.dev' . $path . ($params ? '?' . http_build_query($params) : '');
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('GROUNDSOCIAL_API_KEY')],
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 60,
    ]);
    $raw = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    curl_close($ch);
    $data = json_decode($raw, true);
    if ($status !== 200) {
        $e = $data['error'];
        throw new RuntimeException($e['code'] . ': ' . ($e['hint'] ?? $e['message']));
    }
    return $data;
}

$data = groundsocial('/v1/booking/hotel/rooms', ['id' => '280149', 'check_in' => '2027-03-10', 'check_out' => '2027-03-12']);

foreach ($data['rooms'] as $item) {
    echo $item['id'] ?? '', PHP_EOL;
}

The response

A real Booking.com response to this call, recorded from the live API on 27 Nov 2026 and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 15 items in rooms. Live calls return current data in the same shape.

200 OK
{
  "hotel_id": 280149,
  "check_in": "2027-03-10",
  "check_out": "2027-03-12",
  "available": true,
  "best_offer": {
    "room_id": "28014901",
    "occupancy": 2,
    "meal_plan_id": 2,
    "policy_group_id": "88652304",
    "price": 1868.24624593726,
    "currency": "USD",
    "free_cancellation_until": null,
    "room_name": null
  },
  "price": {
    "amount": 1868.24624593726,
    "formatted": "$1,868.25",
    "currency": "USD"
  },
  "nights": [
    {
      "date": "2027-03-10",
      "available": true,
      "price": 982,
      "price_formatted": "$982",
      "min_stay": 1
    },
    {
      "date": "2027-03-11",
      "available": true,
      "price": 982,
      "price_formatted": "$982",
      "min_stay": 1
    }
  ],
  "rooms": [
    {
      "id": 28014901,
      "name": null,
      "description": null,
      "room_type_id": 9,
      "max_persons": 2,
      "max_children": 1,
      "is_smoking": false,
      "beds": [
        {
          "count": 1,
          "type": "LARGE_DOUBLE_BED",
          "name": "Queen bed(s)"
        }
      ],
      "amenities": [
        "safe_deposit_box",
        "airconditioning",
        "… 34 more"
      ]
    },
    {
      "id": 28014903,
      "name": null,
      "description": null,
      "room_type_id": 7,
      "max_persons": 3,
      "max_children": 0,
      "is_smoking": false,
      "beds": [
        {
          "count": 1,
          "type": "SINGLE_BED",
          "name": "Twin bed(s)"
        }
      ],
      "amenities": [
        "safe_deposit_box",
        "airconditioning",
        "… 31 more"
      ]
    },
    "… 13 more"
  ]
}

Top-level fields

FieldTypeDescription
hotel_idinteger–
check_instring–
check_outstring–
availablebooleanBooking.com has an offer for this stay and party.
best_offerobjectThe lowest-priced room offer for the stay (what search shows).
priceobject–
nightsobject[]–
roomsBookingRoom[]The property’s room types.

Parameters

NameInTypeDescription
idquerystringBooking.com hotel id. Example: 280149.
urlquerystringA property link, https://www.booking.com/hotel/<cc>/<name>.html. Example: https://www.booking.com/hotel/gb/the-savoy.html.
check_inquerystringArrival day, YYYY-MM-DD (required). Example: 2026-12-10.
check_outquerystringDeparture day, YYYY-MM-DD (required). Example: 2026-12-10.
adultsqueryintegerAdults (default 2).
childrenqueryinteger | nullChildren; their ages default to 8 unless children_ages is given.
children_agesquerystringComma-separated ages 0-17, one per child. Example: 5,9.
roomsqueryintegerRooms (default 1).
currencyquerystringISO currency for prices (default USD). Example: EUR.
languagequerystringBooking.com language for texts (en-us, en-gb, de, fr, …). Example: en-gb.

Errors and retries

Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.

Errors
try {
    $data = groundsocial('/v1/booking/hotel/rooms', ['id' => '280149', 'check_in' => '2027-03-10', 'check_out' => '2027-03-12']);
} catch (RuntimeException $e) {
    // "code: hint", e.g. "target_not_found: ..." (never charged).
    fwrite(STDERR, $e->getMessage() . PHP_EOL);
    exit(1);
}
StatusMeaning
200The stay’s offer and the room types.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404No Booking.com property or destination by that id, link or name.
429Too many requests. Wait for Retry-After seconds.
503Booking.com is temporarily unavailable. Retryable; nothing was charged.

Every error code and what to do about it.

Pricing

Cost
Per call2 credits per call
1,000 calls$2.00 on the starter pack, $0.80 at volume
No key (MPP or x402)$0.02 per call
Failed callRefunded, never charged

Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.

From an AI agent (MCP)

The same call is the booking_hotel_rooms tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:

bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp

Then ask for it in words (“A Booking.com property’s room types for a stay, with the best available price and nightly prices”), or call the tool directly:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "booking_hotel_rooms",
    "arguments": {
      "id": "280149",
      "check_in": "2027-03-10",
      "check_out": "2027-03-12"
    }
  }
}

MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.

Use Booking.com hotel rooms in a pipeline

A property for a stay (check_in and check_out required) and party: whether Booking.com has an offer, the best (lowest-priced) offer with its room, meal plan and free-cancellation deadline, the total price, the lowest price night by night with minimum stay, and the property’s room types (name, beds, occupancy, amenities). Logged out, Booking.com’s per-room rate table is only on its challenged hotel page, so other rooms’ prices are not listed.

Keep going

Run it on your own data

One key for Booking.com and 76 more platforms, over REST or MCP. Free credits on signup, no card.

Booking.com is a trademark of its owner. We are not affiliated with or endorsed by it.