DevKits
428

Precondition Required

4xx Client Error

Last updated:

The server requires the request to be conditional (e.g. include If-Match).

Description

Used to prevent the 'lost update' problem by forcing clients to include conditional headers.

When to use

Return 428 when your API requires optimistic concurrency and the client didn't include an If-Match header.

Specification

RFC 6585

Examples

HTTP response
HTTP/1.1 428 Precondition Required
Content-Type: application/json

{"error":"Precondition Required"}
Node.js (Express)
res.status(428).json({ error: "Precondition Required" });
Go (net/http)
w.WriteHeader(http.Status428)
Python (Flask)
return jsonify({"error": "Precondition Required"}), 428

Related status codes

All 4xx codes