428
4xx Client ErrorPrecondition Required
The server requires the request to be conditional to avoid lost updates.
428 Precondition Required means the server insists on conditional requests: it won't accept a write unless you prove you're editing the version you think you are, using If-Match with an ETag. It exists to stop the lost-update problem, where two clients read the same resource, both edit it, and the slower one silently wipes out the faster one's change.
What 428 looks like on the wire
PUT /api/documents/33 HTTP/1.1
Host: api.example.com
Content-Type: application/json
HTTP/1.1 428 Precondition Required
Content-Type: application/json
{"error": "Send an If-Match header so concurrent edits don't overwrite each other"}About 4xx Client Error
The request has a problem the client needs to fix, like a bad URL, missing auth, or invalid input.
How to fix 428 Precondition Required
- Fetch the resource first and note the ETag it returns.
- Retry the write with If-Match set to that ETag.
- Handle 412 responses too - a stale ETag turns into a precondition failure.
Where it's defined
428 Precondition Required is defined in RFC 6585 §3. MDN's 428 reference covers browser behavior and examples.