# 426 Upgrade Required

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

**Family:** 4xx Client Error

## Rationale

Client should switch to a different protocol as indicated by the Upgrade header.

## In Plain Terms

You need to upgrade to a newer or different protocol to access this. It's like needing to update your app to continue using it.

## Description

The HTTP 426 Upgrade Required status code indicates that the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol specified in an Upgrade header field.

## Server Perspective

### Usage
- Return 426 when a specific protocol upgrade is required for the request to succeed
- Use it when the client must switch protocols rather than simply authenticate or change payload shape
- Requiring WebSocket upgrade for certain endpoints
- Requiring an upgrade from HTTP/1.1 to h2c (clear-text HTTP/2) before processing the request
- Transitioning to more secure protocols

### Implementation
- Include Upgrade with acceptable protocols and send Connection: Upgrade
- Explain the required protocol clearly when clients may not recognize the need automatically

### Common Headers
- Upgrade
- Connection

### Body
- Optionally include a concise explanation of the required protocol upgrade.

### Pitfalls
- Do not use 426 when protocol upgrade is optional
- Do not confuse 426 with 505, which is about unsupported HTTP versions rather than an offered upgrade path
- Protocol version not supported (use 505 HTTP Version Not Supported)
- Bad request format (use 400 Bad Request)
- When protocol upgrade is optional

## Client Perspective

### Pitfalls
- Do not keep retrying on the same protocol and expect a different result

## Examples

### WebSocket upgrade required

Endpoint only available via WebSocket protocol

**Request:**
```
GET https://api.example.test/websocket-endpoint
```

**Response:**
```
426 Upgrade Required
Upgrade: websocket
Connection: Upgrade
```

## Related Codes

- [505 HTTP Version Not Supported](/docs/505.md)
- [400 Bad Request](/docs/400.md)

