
Status code 428 is intended to prevent the 'lost update' problem. This problem arises when a client makes a GET request on a given resource's state, changes said state, and PUTs it back. And at the same time another client has made a change on the same resource on the server.
HTTP 428 Precondition Required is a client error status code indicating that the server requires the request to be conditional. It means a required precondition header — such as If-Match or If-Unmodified-Since — is missing from the request. The server will not process the request until the client resubmits it with the appropriate header.
A server returns 428 when it has been configured to require conditional requests for certain operations — most commonly PUT requests that modify a resource. This is especially common in APIs that handle concurrent edits, where the server needs to verify the client is working from the latest version of a resource before accepting changes.
To fix a 428 error, add the precondition header the server requires to your request. First, fetch the current state of the resource (typically via GET) to obtain its ETag or last-modified timestamp, then include that value in an If-Match or If-Unmodified-Since header on your update request. Check the API documentation to confirm which specific header the server expects.
Both codes relate to preconditions, but they signal different problems. A 428 means the required precondition header is entirely absent from the request. A 412 Precondition Failed means the header was present but its value did not match the server's current resource state — for example, the ETag you sent no longer matches because someone else already updated the resource.
HTTP 428 is designed to prevent the "lost update" problem in concurrent environments. This occurs when two clients retrieve the same resource, make independent changes, and then both submit updates — causing the first client's changes to be silently overwritten by the second. By requiring conditional headers, the server ensures each client confirms the resource has not changed before its update is accepted.
The most common headers used to satisfy a 428 requirement are If-Match (paired with an ETag value) and If-Unmodified-Since (paired with a timestamp). Other valid conditional headers include If-None-Match, If-Modified-Since, and If-Range. The specific header required depends on how the server is implemented, so consult the API documentation when in doubt.