The Bookings API handles reservation creation for both accommodation properties and guided tours. All bookings begin inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/IvanchoDev89/maleku-system/llms.txt
Use this file to discover all available pages before exploring further.
pending status and transition to confirmed once a Stripe payment is completed. Dynamic pricing applies weekend rates, extra-guest surcharges, and weekly discounts automatically. A unique confirmation code in the format CRT-XXXXXXXX is generated for every booking.
Create Property Booking
POST /api/v1/bookings/property
Creates a new property/room booking. Theroom_id field is required — bookings are priced at the room level, not the property level. A PostgreSQL advisory lock is acquired on the (room_id, check_in, check_out) combination before inserting the booking to prevent race conditions.
Auth: Bearer token — verified email required
Rate limit: 10 requests/minute per IP
UUID of the property to book.
UUID of the specific room within that property. Must belong to
property_id.ISO 8601 datetime for arrival. Must be in the future.
ISO 8601 datetime for departure. Must produce at least 1 night.
Total number of guests. Must be ≥ 1.
Lead guest full name (2–255 characters).
Lead guest email address.
Lead guest phone number (optional).
Special requests or notes for the vendor (optional).
201
The booking system uses PostgreSQL advisory locks to prevent double-booking. When two requests arrive for the same room and overlapping dates simultaneously, the second request blocks until the first transaction commits, then re-checks availability before proceeding. This eliminates the TOCTOU (time-of-check/time-of-use) race condition entirely.
Create Tour Booking
POST /api/v1/bookings/tour
Creates a new tour booking. An advisory lock is acquired on(tour_id, booking_date) before inserting. The participants count is validated against the tour’s max_group_size.
Auth: Bearer token — verified email required
Rate limit: 10 requests/minute per IP
UUID of the tour to book.
ISO 8601 datetime for the tour date/time. Must be in the future.
Number of participants. Must not exceed the tour’s
max_group_size.Lead guest full name.
Lead guest email address.
Lead guest phone (optional).
Special requests (optional).
201 — same BookingResponse shape as property booking, with booking_type: "tour", tour_id populated, and property_id / room_id as null.
List Bookings
GET /api/v1/bookings/
Returns paginated bookings scoped to the authenticated user’s role:- CLIENT — sees only their own bookings
- VENDOR — sees all bookings for their properties and tours
- ADMIN / SUPER_ADMIN — sees all bookings platform-wide
Filter by booking status:
pending, confirmed, cancelled, completed, refunded.Filter by type:
property or tour.Page number.
Items per page. Maximum 100.
Get Booking
GET /api/v1/bookings/
Returns a single booking with all related objects (user, vendor, property, room, tour) eagerly loaded. Access is scoped by role — clients can only access their own bookings, vendors only those belonging to their profile. Auth: Bearer token Response404 — { "detail": "Booking not found" }
Response 403 — { "detail": "Not authorized" }
Cancel Booking
PUT /api/v1/bookings//status
Updates booking status. Thestatus field drives the allowed transitions:
- VENDOR — can set status to
confirmedorcancelled - CLIENT — can only set status to
cancelled(their own booking) - ADMIN / SUPER_ADMIN — can set any status
New status value. Accepted:
confirmed, cancelled, completed.When a booking is cancelled after payment has been captured, trigger a refund via
POST /api/v1/stripe/bookings/{id}/refund. See the Payments API for details.Price Preview
POST /api/v1/bookings/preview
Returns a full price breakdown for a room/date combination without creating a booking. Use this to display the pricing summary to users before they confirm. Auth: Bearer token Rate limit: 30 requests/minute per IPUUID of the room to price.
ISO 8601 arrival datetime.
ISO 8601 departure datetime.
Total number of guests.
200 — PricePreviewResponse
Booking Status Flow
Bookings follow a defined lifecycle:| Status | Description |
|---|---|
pending | Booking created, awaiting Stripe payment |
confirmed | Payment captured successfully via Stripe webhook |
completed | Stay/tour has concluded |
cancelled | Cancelled by client, vendor, or admin |
refunded | Payment refunded through Stripe |
Pricing Logic
Property bookings apply a multi-factor pricing calculation:- Weekday rate —
Room.price_per_nightfor Sunday–Thursday nights - Weekend rate —
Room.weekend_pricefor Friday–Saturday nights - Extra guest surcharge —
Room.extra_guest_price × (guests − max_occupancy)when guests exceed the room’s base occupancy - Weekly discount —
Property.weekly_discount% reduction on subtotal for stays ≥ 7 nights
Tour.price × participants.