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
- 1First make a GET request to obtain the resource's current ETag
- 2Include If-Match: "etag-value" header in your PUT/PATCH/DELETE request
- 3If using If-Unmodified-Since, include the Last-Modified date from the GET response
- 4Update your API client to always fetch before modifying protected resources
- 5Check API documentation for which endpoints require conditional headers
Tags
http428precondition-requiredetagoptimistic-locking
More in 4xx Client Error
http-400-bad-requestHTTP 400 Bad Request — What It Means & How to Fix It
Errorhttp-401-unauthorizedHTTP 401 Unauthorized — What It Means & How to Fix It
Errorhttp-402-payment-requiredHTTP 402 Payment Required — What It Means & How to Fix It
Errorhttp-403-forbiddenHTTP 403 Forbidden — What It Means & How to Fix It
Errorhttp-404-not-foundHTTP 404 Not Found — What It Means & How to Fix It
Errorhttp-405-method-not-allowedHTTP 405 Method Not Allowed — What It Means & How to Fix It
ErrorFrequently Asked Questions
When two clients read a resource, both modify it, and the last write overwrites the first without knowing about it.