4xx Client Error

HTTP 428 Precondition Required

The server requires the request to be conditional. This is intended to prevent the 'lost update' problem, where a client GETs a resource, modifies it, and PUTs it back while a third party has modified it.

Common Causes

  • Server requires If-Match or If-Unmodified-Since header
  • Optimistic concurrency control is enforced
  • API mandates conditional requests for write operations

How to Fix

  1. 1Add an If-Match header with the current ETag
  2. 2Fetch the resource first to get its ETag, then send conditional request
  3. 3Include If-Unmodified-Since with the last known modification date

Example

HTTP 428 Precondition Required
PUT /api/doc/1 HTTP/1.1
(no If-Match header)

→ 428 Precondition Required
→ "Include If-Match header for updates"

Related Client Error Codes