What does HTTP status code 412 mean?
The 412 Precondition Failed status code indicates that one or more conditional checks specified in the client’s request headers (like If-Match) failed.
When to use it in APIs
Used in conditional updates. A client submits a PUT request with If-Match: "etag_value". If the resource ETag has changed on the server, the server returns 412 to prevent the client from overwriting concurrent changes.
How it compares to other codes
- 409 Conflict: A general state conflict. 412 is strictly tied to HTTP headers-based optimistic concurrency control.