Skip to the content

428 Precondition Required

The server only accepts this request with a condition attached, such as an If-Match header, so that changes can't overwrite each other.

Class
4xx Client error. The request is the problem: a wrong address, missing credentials, data the server can't accept.
Defined in
RFC 6585

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

What causes it

When an API wants protection against lost updates. Two clients fetch the same record, both change it and both save, and the second save silently wipes out the first. A server that requires If-Match, with the ETag of the version being changed, refuses requests without it with a 428.

What to do about it

Fetch the resource, take the ETag from the response and send your change with an If-Match header that holds it. If someone else was quicker you get a 412, and you fetch again. If you build the API, say in the body which header is missing.

Not to be confused with

412 Precondition FailedThe condition was sent and turned out to be false.
409 ConflictA conflict found without the help of a condition.

All codes are on the list of HTTP status codes, which can be searched by number and by word.

See all 12