/v1/bookings (POST)
const url = 'http://localhost:8787/v1/bookings';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"currency":"example","from":"2026-04-15T12:00:00Z","guestEmail":"hello@example.com","guestName":"example","guestPhone":"example","occupancyChildren":1,"paidOffline":false,"partySize":1,"quantity":1,"ratePlanId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","resourceId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","to":"2026-04-15T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8787/v1/bookings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "currency": "example", "from": "2026-04-15T12:00:00Z", "guestEmail": "hello@example.com", "guestName": "example", "guestPhone": "example", "occupancyChildren": 1, "paidOffline": false, "partySize": 1, "quantity": 1, "ratePlanId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "resourceId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "to": "2026-04-15T12:00:00Z" }'Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Responses
Section titled “Responses”The SAME booking a prior request with this Idempotency-Key already created.
object
object
object
Example
{ "booking": { "state": "pending" }, "payment": { "state": "requires_payment" }}paidOffline: true -> the booking, already confirmed, payment: null. Otherwise -> the booking, still held, with a payable PaymentIntent handle.
object
object
object
Example
{ "booking": { "state": "pending" }, "payment": { "state": "requires_payment" }}Missing Idempotency-Key header, from not strictly before to, or (with a room-type resource) a missing/unresolvable rate plan.
object
Example
{ "code": "idempotency_key_required"}No such resource (or rate plan) for this tenant.
object
Example
{ "code": "idempotency_key_required"}The stay fails availability/restrictions, the resource is locked by a concurrent attempt, it’s already held/booked (the EXCLUDE constraint), this Idempotency-Key is already in use by a different (non-manual) reservation, or (payment-link mode) the tenant has no usable Stripe Connect account.
object
object
Example
{ "code": "unavailable", "reasons": [ "occupancy_exceeded" ]}No applicable pricing rule for one or more nights, or no FX rate available.