HTTP 428 — Precondition Required
HTTP 428 flips 412 into a demand: the server requires conditional headers — If-Match and friends — and refuses unconditional writes that could silently clobber someone else’s work.
When 428 shows up
- Editing APIs that mandate optimistic concurrency on every write.
- Storage backends preventing lost updates from careless clients.
Mocking a 428 response
A response with this status can be faked end to end with a local mock rule — no backend changes needed. The configuration below mirrors the rule fields the ApiSimul editor uses (method, path, status, delay in milliseconds, response body):
{
"method": "GET",
"path": "/api/notes/{{param.id}}",
"status": 428,
"delay": 190,
"enabled": true,
"body": {
"error": "precondition_required",
"hint": "send If-Match with the latest ETag"
}
}Dynamic placeholders such as {{random.name}}, {{string.uuid}} or {{number.int 1 100}} can appear inside the body to vary each response, which keeps client-side list rendering and retry logic honest during development.
Frequently asked questions
What does HTTP 428 mean?
The request must carry conditional headers proving it is based on the current state. Adding If-Match with the latest ETag satisfies it.
How can I test a 428 response without a real backend?
Define a mock rule with the method and path your client requests and set the status to 428. The example configuration above returns this response after the listed delay, so the client exercises its 428 handling exactly as it would against a live server.
Related status codes
Need the response in your own project? Spin up rules for any status with the ApiSimul mock server, or browse every status code page.