HTTP 428 Precondition Required

The server requires the request to be conditional.

4xx Client Error

428

Precondition Required

Description

The 428 Precondition Required status code indicates that the origin server requires the request to be conditional. Its typical use is to avoid the lost update problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. By requiring requests to be conditional, the server can assure that clients are working with the correct copies. This status code was introduced in RFC 6585 and is different from 412 Precondition Failed, which indicates that a precondition was present but evaluated to false.

When Is It Used?

Used to require clients to include conditional headers (like If-Match with an ETag) in their requests. This prevents lost updates in concurrent editing scenarios by requiring clients to prove they have the latest version before modifying a resource.

Example Response

HTTP/1.1 428 Precondition Required
Content-Type: application/json

{"error": "precondition_required", "message": "This request must include an If-Match header with the current ETag"}

Look Up Any Status Code

Browse all status codes