# 428 Precondition Required

> https://http-status.org/docs/428

**Family:** 4xx Client Error

## Rationale

The origin server requires the request to be conditional (RFC 6585).

## In Plain Terms

You're trying to change something, but you need to tell me what you expect it to look like first, so we don't accidentally overwrite someone else's changes.

## Description

The HTTP 428 Precondition Required status code indicates that the origin server requires the request to be conditional to prevent lost update problems.

## Server Perspective

### Usage
- Return 428 when clients must send validators such as If-Match before updating a resource
- Use it in optimistic concurrency flows where blind overwrites are not allowed
- Updates require conditional headers for safety
- Preventing lost update problems
- Enforcing optimistic concurrency control
- When If-Match or similar headers are mandatory

### Implementation
- Tell the client which precondition header is required, such as If-Match
- Document the fetch-edit-update flow so clients know how to obtain the needed validator

### Common Headers
- No status-specific header is required; identify the required conditional header in the response body or API documentation.

### Body
- Include the required precondition pattern, such as If-Match with the latest ETag.

### Pitfalls
- Use 412 when the client sent a precondition and it failed
- Do not leave the client guessing which validator or concurrency pattern is required
- Precondition provided but failed (use 412 Precondition Failed)
- General conflicts (use 409 Conflict)
- Read-only operations that don't need conditions

## Client Perspective

### Pitfalls
- Do not retry the same unconditional write request and expect a different result

## Examples

### Update without precondition header

Server requires If-Match header to prevent concurrent updates

**Request:**
```
PUT https://api.example.test/api/users/123
```

**Response:**
```
428 Precondition Required
Content-Type: application/json

{
  "error": "precondition_required"
}
```

## Related Codes

- [412 Precondition Failed](/docs/412.md)
- [409 Conflict](/docs/409.md)

