POST /v1/scheduling/booking/resource-bookings
Book a resource for a customer: a stay on a night resource, or a time block on a block resource.
POST
Book a resource: a stay on a night resource or a block
Creates a resource booking on behalf of a customer. The body depends on the resource’s
Other
Other
On
booking_unit (see GET resources):
- Night resource:
check_inandcheck_out, and optionally the arrival and departure times. - Block resource:
date,start_timeand optionallyduration_minutes.
400 RESOURCE_BOOKING_UNIT_MISMATCH.
Keebai checks the whole stay again when you book (windows, minimum and maximum nights, notice, party size and room every night), so a quote that went stale returns 409 STAY_FULL instead of overbooking. The customer is found or created in the CRM by phone. The booking is recorded with source api.
Prepayment. When the resource asks for a prepayment, the booking lands in awaiting_payment with a payment link for that amount and a hold. It occupies its nights until the hold expires; if the customer has not paid by then, Keebai cancels it. Without a prepayment it lands in booked.
Endpoint
Required scope
scheduling:appointments:create
Headers
Authorization: Bearer kbai_pk_<token>. Required.Content-Type: application/json. Required.Idempotency-Key: required. 1 to 128 letters, digits,-or_. A retry with the same key returns the first booking instead of creating another.
Body: stay on a night resource
resource_id,check_in,check_out,customer.nameandcustomer.phone: required.branch_id: optional. Defaults to the resource’s branch.check_in_time: arrival time, inside the day’s check-in window. Omitted ornull: the stay starts when the window opens.check_out_time: departure time, inside the day’s check-out window. Omitted ornull: the stay ends when the window closes.party_size: guests. Defaults to 1.customer.customer_id: the CRM customer id, when you already have it.notes: shown to the business on the booking (max 1000 characters).
Body: block on a block resource
dateandstart_timemust be a block that GET resources/availability offers.duration_minutes: one of the resource’sdurations_minutes. Defaults to the first one.
origin, agent and any other field are rejected with 400: the public API always books as api.
Example request
Response
201 Created: stay
number: correlative of the booking, shared with the business’s appointments.check_in,check_out,nightsand the times are computed fromstartandendintime_zone; nothing else is stored.price: the whole booking.balanceispriceminusamount_paid.contact: the public API never returns the customer’s phone or email here.status:awaiting_payment(hold with a payment link),booked,confirmed,completed,no_showorcancelled.payment_status:pending,partial,paid,refundedorcancelled.
201 Created: block
The booking has the same fields, except that the night fields are replaced by the block’s:400 Bad Request
400 codes:
404 Not Found
RESOURCE_NOT_FOUND or BRANCH_NOT_FOUND.
409 Conflict
409 codes:
STAY_FULL or RESOURCE_CONFLICT, quote again and offer the new options. Do not retry the same dates. On RESOURCE_PROFESSIONAL_BUSY, don’t retry that block: check GET resources/availability again for that day and offer another time or day. On RESOURCE_BUSY, retry the same request with the same Idempotency-Key after a short pause.
422 Unprocessable Entity
ONLINE_PAYMENT_UNAVAILABLE: the resource asks for a prepayment and the business can’t take online payments right now. Nothing is booked.
502 Bad Gateway
PAYMENT_LINK_FAILED: the resource asks for a prepayment and the payment link could not be created. Keebai cancels the booking it had just made, so its nights are free again. Try again later.
503 Service Unavailable
RESOURCE_LOCK_UNAVAILABLE with retryable: true: Keebai couldn’t lock the resource to write the booking. Nothing is booked. Retry the same request with the same Idempotency-Key after a short pause.
401 Unauthorized · 403 Forbidden
Same semantics as the rest of the public API.Authorizations
Body
application/json
Response
201
Book a resource: a stay on a night resource or a block