Sign in for interactive examples and your API keys.
Get free API keysDocsBooking
Booking
Create, confirm, cancel, and manage bookings via the REST API or SDK.
Overview
The Booking API is the core of BookRails. A booking has a lifecycle: pending → confirmed → completed | cancelled | no_show. Idempotency keys make it safe to retry any operation.
Create a booking
javascript
import BookRails from "@bookrails/sdk";
const br = new BookRails(process.env.BOOKRAILS_API_KEY);
// 1. Search availability
const slots = await br.availability.search({
service: "haircut",
near: "Brooklyn, NY",
after: new Date().toISOString(),
});
// 2. Create booking
const booking = await br.bookings.create({
slotId: slots[0].id,
customer: { name: "Olivia Bennett", email: "olivia@example.com" },
idempotencyKey: crypto.randomUUID(),
});
console.log(booking.confirmationCode); // "LUME-7F3A"Cancel a booking
javascript
const result = await br.bookings.cancel(bookingId, {
reason: "customer_requested",
// Fee computed from policy automatically
});
// result.feeCents — cancellation fee per policyOn this page