HTTP 428 Precondition Required
HTTP 428 Precondition Required means the server requires the request to be conditional, typically by including an If-Match header with the resource’s ETag.
Quick answer
HTTP 428 Precondition Required means the server requires the request to be conditional, typically by including an If-Match header with the resource’s ETag. APIs use it to force clients to prove they are editing the latest version and avoid lost updates.
Last updated · Maintained by FreeAIToolz · How we test
What does HTTP 428 Precondition Required mean?
Where 412 says “your precondition failed”, 428 says “you must send one”. It pushes clients towards the read-then-update-with-ETag pattern.
| Status code | 428 |
|---|---|
| Name | Precondition Required |
| Class | 4xx Client Error |
| Defined in | RFC 6585 |
| Cacheable by default | No, unless Cache-Control says so |
| Safe to retry automatically? | No: change the request first |
| Related headers | If-Match, ETag |
What causes HTTP 428?
- An update request without If-Match or If-Unmodified-Since on an API that requires it.
How do I fix HTTP 428?
- Fetch the resource, read its ETag, and send it back in If-Match.
What should a client do after HTTP 428?
Add the precondition header and retry.
Does HTTP 428 affect SEO?
No SEO impact.
Example 428 response
HTTP/1.1 428 Precondition Required
Date: Mon, 01 Dec 2026 12:00:00 GMT
Content-Type: application/json
{"error":{"status":428,"message":"Precondition Required"}} How to return 428 Precondition Required in code
Express (Node.js)
res.status(428).json({ error: 'Precondition Required' }); Next.js route handler
return Response.json({ error: 'Precondition Required' }, { status: 428 }); FastAPI (Python)
raise HTTPException(status_code=428, detail="Precondition Required") PHP
http_response_code(428); Nginx
location = /example {
return 428;
} Other 4xx status codes
The request contains an error or cannot be fulfilled as sent. Fix the request before retrying.
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 425 Too Early
- 426 Upgrade Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request
Frequently asked questions
428 vs 412?
Which APIs use 428?
Is 428 a client or server error?
Related
- 412 Precondition Failed HTTP 412 Precondition Failed means a condition the client set in a request header, such as If-Match or If-Unmo.
- 409 Conflict HTTP 409 Conflict means the request conflicts with the current state of the resource.
- 304 Not Modified HTTP 304 Not Modified means the client’s cached copy is still valid, so the server sends no body.
- Open the HTTP Status Codes Reference → Free, no signup.