Endpoint
Request Body
The unique identifier of the apartment to book.Example:
a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5dThe unique identifier of the user making the booking.Example:
7b9c3d1e-4f2a-5c6d-8e9f-0a1b2c3d4e5fThe check-in date in ISO 8601 format (YYYY-MM-DD).Example:
2024-06-15The check-out date in ISO 8601 format (YYYY-MM-DD). Must be after
startDate.Example: 2024-06-20Response
On success, returns the unique identifier (UUID) of the newly created booking.Example Request
Example Response
Status Code:201 Created
Headers:
Error Responses
400 Bad Request
Returned when the request contains invalid data or violates business rules.Validation.Error- Invalid request parameters (missing fields, invalid format)Booking.Overlap- The apartment has a conflicting booking for the specified datesApartment.NotFound- The specified apartment does not existUser.NotFound- The specified user does not existBooking.InvalidDateRange- End date is before or equal to start dateBooking.PastDate- Start date is in the past
401 Unauthorized
Returned when the request lacks valid authentication credentials.500 Internal Server Error
Returned when an unexpected server error occurs.Usage Notes
- The booking is created with a “Reserved” status (status code: 0)
- The API calculates the total price based on the nightly rate, cleaning fees, and amenities
- Dates are inclusive (both start and end dates are part of the booking period)
- The apartment must be available for the entire date range (no overlapping bookings)
- Use the returned booking ID to retrieve full booking details via the Get Booking endpoint
Booking Workflow
- Search for available apartments using the Search Apartments endpoint
- Reserve the apartment using this endpoint
- Confirm the booking (status changes from Reserved to Confirmed)
- Complete the stay
- Review the apartment using the Add Review endpoint
Price Calculation
The total booking price includes:- Nightly rate × Number of nights
- Cleaning fee (one-time charge)
- Amenities upcharge (if applicable)
Related Endpoints
- Get Booking - Retrieve booking details
- Search Apartments - Find available apartments
- Get Current User - Get your user ID for bookings