Error Codes Wiki

HTTP 428 Precondition Required — Conditional Headers Mandatory

Warning4xx client error

Overview

HTTP 428 Precondition Required means the server requires the request to include conditional headers like If-Match to prevent lost update problems.

Key Details

  • Server mandates conditional headers (If-Match, If-Unmodified-Since) for this request
  • Prevents the lost update problem where concurrent changes overwrite each other
  • The server is enforcing optimistic concurrency control
  • You must first GET the resource to obtain the current ETag, then use If-Match
  • Different from 412 where conditions were sent but failed — 428 means conditions were not sent at all

Common Causes

  • API requires If-Match header but client did not include it
  • PUT or PATCH request without conditional headers on a protected resource
  • Server enforcing optimistic locking on all write operations
  • Version-controlled resource requiring version check before modification

Steps

  1. 1First make a GET request to obtain the resource's current ETag
  2. 2Include If-Match: "etag-value" header in your PUT/PATCH/DELETE request
  3. 3If using If-Unmodified-Since, include the Last-Modified date from the GET response
  4. 4Update your API client to always fetch before modifying protected resources
  5. 5Check API documentation for which endpoints require conditional headers

Tags

http428precondition-requiredetagoptimistic-locking

More in 4xx Client Error

Frequently Asked Questions

When two clients read a resource, both modify it, and the last write overwrites the first without knowing about it.