428 🌐 HTTP

HTTP 428 Precondition Required

The server requires a conditional request (If-Match / If-Unmodified-Since) to prevent lost updates, and you didn’t send one.

Seen on: REST API

Meaning

Where 412 means your condition failed, 428 means you sent no condition at all. APIs that enforce optimistic concurrency (some Microsoft, GitHub-style and custom REST APIs) refuse unconditional PUT/PATCH/DELETE so two clients can’t silently overwrite each other.

Common causes

  • PUT/PATCH/DELETE sent without If-Match
  • Client discarded the ETag from the earlier GET
  • Proxy/CDN stripped the ETag or If-Match header

⚡ Quick fix

  1. GET the resource first and keep its ETag header
  2. Send If-Match: <etag> on the update
  3. Make sure proxies forward ETag/If-Match unchanged

Detailed fix by platform

REST API

  1. Conditional update:
    bash
    ETAG=$(curl -sI https://api.example.com/docs/42 | awk -F': ' 'tolower($1)=="etag"{print $2}' | tr -d '\r')
    curl -X PUT https://api.example.com/docs/42 -H "If-Match: $ETAG" -H 'Content-Type: application/json' -d '{"title":"New"}'

How to diagnose

  1. Headers — Did the request include If-Match?
  2. ETag — Did the GET response include one?
  3. Proxies — Is any hop stripping these headers?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.