428 Precondition Required

HTTP response status code 428 Precondition Required is returned by the server to indicate that HTTP requests of this type must be made conditionally, yet no precondition was included.


When the 428 Precondition Required status code is received, the server expects that HTTP requests of this type be conditional and include an appropriate HTTP header such as If-Match, If-None-Match,If-Modified-Since, and If-Unmodified-Since.

These HTTP headers can optionally be used by clients when supported by the server but in this case, the server requires that they are used. Depending on the use case, this is intended to reduce instances of data loss such as the ‘lost update’ problem.

A lost update can occur when a client uses HTTP method GET to obtain a resource, then modifies it, and uses HTTP method PUT to send it back to the server. Without third-party interference, there is no problem. However, if after the initial HTTP method GET, a third party modified the state of the resource on the server, it can lead to a conflict. If the client uses HTTP method PUT without first checking the state of the resource, then the third party’s update is overwritten. Hence, it is a lost update.

By enforcing the use of conditional tests using [etag|Etags] and dates, the opportunities for clients to overwrite updates are lowered because fewer assumptions can be made about the state of the resource.

This is related to the 412 Precondition Failed response, which will be sent by the server when one or more of the conditions does not pass.


Search engines like Google will not index a URL with 428 Precondition Required response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.


In the example, the client had previously obtained a copy of the resources and since that time, has modified it. When the client attempts to PUT the resource and update the server, the server responds with the 428 Precondition Required status because the HTTP headers did not include a conditional test.


PUT /reservations.txt HTTP/1.1
Host: www.example.re


HTTP/1.1 428 Precondition Required
Content-Type: text/html
Content-Length: 193

    <title>Conditional Update Required</title>
   <p>This PUT request must be done conditionally. Try again using “If-Unmodified-Since”.</p>

Code references













Apache HttpComponents Core





The 428 Precondition Required status code is a client error that is sent by the server when the client needs to submit the HTTP request conditionally, but an appropriate HTTP header was not part of the HTTP request. The client needs to add the precondition and resubmit the HTTP request.

See also

Last updated: August 2, 2023