Client Error · 4xx

428 Precondition Required

The server requires the request to be conditional.

What 428 Precondition Required means

428 Precondition Required tells the client to add an If-Match or similar conditional header before the server will process the request. This is a defense against the "lost update" problem: the server is saying "do not let me write this without you confirming you saw the latest version". You see 428 most often on PUT and PATCH endpoints that mandate optimistic concurrency control.

When servers should return it: Return 428 from PUT/PATCH endpoints that require ETag-based concurrency to prevent lost updates.

Common causes

How to fix 428 Precondition Required

Example response

curl -i -X PUT -d '{"name":"Ada"}' https://api.example.com/users/42

HTTP/2 428
content-type: application/json
{"error":"precondition required","need":"If-Match header"}

Related status codes

Frequently Asked Questions

428 vs 412?
428 = "you did not include a precondition header at all". 412 = "you included one and it did not match".
Defined in: RFC 6585 · Class: 4xx Client Error

More references

For a one-page reference of all HTTP status codes, see the HTTP cheat sheet. For testing API responses, try the API Tester tool. For inspecting responses on the command line, the curl cheat sheet covers the most common flags.