Error Codes Wiki

HTTP 428 Precondition Required — Conditional Headers Mandatory

Warning4xx client error

About HTTP 428 Precondition Required

HTTP 428 Precondition Required means the server requires the request to include conditional headers like If-Match to prevent lost update problems. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Server mandates conditional headers (If-Match, If-Unmodified-Since) for this request. Prevents the lost update problem where concurrent changes overwrite each other. The server is enforcing optimistic concurrency control. You must first GET the resource to obtain the current ETag, then use If-Match. Different from 412 where conditions were sent but failed — 428 means conditions were not sent at all. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: API requires If-Match header but client did not include it. PUT or PATCH request without conditional headers on a protected resource. Server enforcing optimistic locking on all write operations. Version-controlled resource requiring version check before modification. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: First make a GET request to obtain the resource's current ETag. Include If-Match: "etag-value" header in your PUT/PATCH/DELETE request. If using If-Unmodified-Since, include the Last-Modified date from the GET response. Update your API client to always fetch before modifying protected resources. Check API documentation for which endpoints require conditional headers. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What is the lost update problem?

When two clients read a resource, both modify it, and the last write overwrites the first without knowing about it.

Overview

HTTP 428 Precondition Required means the server requires the request to include conditional headers like If-Match to prevent lost update problems.

Key Details

  • Server mandates conditional headers (If-Match, If-Unmodified-Since) for this request
  • Prevents the lost update problem where concurrent changes overwrite each other
  • The server is enforcing optimistic concurrency control
  • You must first GET the resource to obtain the current ETag, then use If-Match
  • Different from 412 where conditions were sent but failed — 428 means conditions were not sent at all

Common Causes

  • API requires If-Match header but client did not include it
  • PUT or PATCH request without conditional headers on a protected resource
  • Server enforcing optimistic locking on all write operations
  • Version-controlled resource requiring version check before modification

Steps

  1. 1First make a GET request to obtain the resource's current ETag
  2. 2Include If-Match: "etag-value" header in your PUT/PATCH/DELETE request
  3. 3If using If-Unmodified-Since, include the Last-Modified date from the GET response
  4. 4Update your API client to always fetch before modifying protected resources
  5. 5Check API documentation for which endpoints require conditional headers

Tags

http428precondition-requiredetagoptimistic-locking

More in 4xx Client Error

Frequently Asked Questions

When two clients read a resource, both modify it, and the last write overwrites the first without knowing about it.