I am working on a booking app where I need to book appointments, I want to return the most appropriate HTTP code that says that the booking slot wanted by the user is not available, that it's not possible to book at that time due to the non availability of the other user ?

  • 2
    This sounds more like a content response than a status response. From a technical perspective, the call succeeded precisely the way you (the backend) wanted it to.
    – Flater
    Commented Jan 14, 2022 at 13:36
  • Actually before doing the booking server-side i check if the other user is available at that time, if yes I proceed with creating the booking Object, if not I want to return a message saying res.status(xxx).send({message:'Booking time not available}) , what should the status code be in your opinion? Commented Jan 14, 2022 at 13:39

2 Answers 2


409 conflict is often used for this sort of situation. It means your request conflicts with the current state of the resource.

It's also relatively common to use eTags and If-Match headers to make sure a resource didn't change between when a GET showed it available and when you tried to book it. In this case, it would return a 412 precondition failed.

There's a case to be made for returning a 200, but a client's state not matching the server's state certainly fits into the 4xx client error realm.


Don't use an HTTP status code to communicate this information.

HTTP status codes are about the communication between the client and the server. For example, the 2xx codes indicate that the server received and accepted the response while the 5xx codes indicate that the request is probably valid but the server was unable to handle it.

Since the server is able to accept the response and determine that the reason it cannot be fulfilled is related to business logic and not client/server communication, the response should be one of the 2xx responses and the body should contain information about the ability to book the appointment.

  • I'm inclined to agree in principle with your premise. Folks tend to use these codes beyond their intended scope. Commented Jan 14, 2022 at 17:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.