Skip to main content

Node.js SDK

:::caution Not yet published There is currently no official Booking Brain SDK on npm. An earlier version of this page documented an @bookingbrain/sdk package that was never published — running npm install @bookingbrain/sdk fails with a 404. Until an official SDK ships, integrate with the REST API directly. :::

Calling the API without an SDK

The API is a straightforward REST API — every endpoint works with fetch and the X-API-Key header. See the Quick Start for a walkthrough.

const BASE = "https://app.bookingbrain.com/api/v1";

async function bb(path: string, init: RequestInit = {}) {
const res = await fetch(`${BASE}${path}`, {
...init,
headers: {
"X-API-Key": process.env.BB_API_KEY!,
"Content-Type": "application/json",
...init.headers,
},
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
return res.json();
}

// Search properties
const results = await bb(
"/developer/search?" +
new URLSearchParams({
property_place_slug: "stay-in-porlock",
checkin: "2026-07-04",
booking_nights: "7",
guests: "4",
no_of_dogs: "1",
sort_by: "cheap_price",
})
);

for (const property of results.properties) {
console.log(`${property.title} — £${property.min_price}${property.bed_rooms} bed`);
}

For request/response types you can generate a typed client from the OpenAPI specification with tools such as openapi-typescript or openapi-generator.

Next steps