HTTP 4xx Client Error Status Codes

Client error responses like 400, 401, 403, 404, 409, 422, and 429.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Codes 400-409
HTTP 400 Bad Request
curl -i -X POST https://example.com/api -H 'Content-Type: application/json' -d '{bad json}'

# Malformed or invalid request

HTTP 401 Unauthorized
curl -i https://example.com/private

# Authentication required or invalid

HTTP 402 Payment Required
HTTP/1.1 402 Payment Required

# Reserved / rarely used

HTTP 403 Forbidden
curl -i -H 'Authorization: Bearer token' https://example.com/admin

# Authenticated but not allowed

HTTP 404 Not Found
curl -i https://example.com/does-not-exist

# Resource does not exist

HTTP 405 Method Not Allowed
curl -i -X PATCH https://example.com/static-page

# Method not supported on target resource

HTTP 406 Not Acceptable
curl -i -H 'Accept: application/xml' https://example.com/json-only

# No acceptable representation available

HTTP 407 Proxy Authentication Required
curl -x http://proxy.example.com:8080 https://example.com

# Proxy requires authentication

HTTP 408 Request Timeout
HTTP/1.1 408 Request Timeout

# Server timed out waiting for request

HTTP 409 Conflict
curl -i -X PUT https://example.com/api/items/1 -H 'If-Match: "stale-etag"' -d '{"x":1}'

# Request conflicts with current state

## Codes 410-421
HTTP 410 Gone
curl -i https://example.com/removed

# Resource intentionally removed

HTTP 411 Length Required
curl -i -X POST https://example.com/upload --data-binary @file.bin

# Missing required Content-Length

HTTP 412 Precondition Failed
curl -i -X PUT https://example.com/item/1 -H 'If-Match: "wrong"' -d '{"a":1}'

# Conditional request condition not met

HTTP 413 Content Too Large
curl -i -X POST https://example.com/upload --data-binary @huge.tar

# Payload too large

HTTP 414 URI Too Long
curl -i 'https://example.com/search?q=very-long-string'

# Request target too long

HTTP 415 Unsupported Media Type
curl -i -X POST https://example.com/api -H 'Content-Type: text/plain' -d 'name=ada'

# Request body media type not supported

HTTP 416 Range Not Satisfiable
curl -i -H 'Range: bytes=99999999-999999999' https://example.com/file.zip

# Requested byte range is invalid

HTTP 417 Expectation Failed
curl -i -H 'Expect: some-unknown-expectation' https://example.com

# Expectation cannot be met

HTTP 418 I'm a teapot
HTTP/1.1 418 I'm a teapot

# Humorous / non-standard in practice

HTTP 421 Misdirected Request
curl -i https://example.com

# Request sent to wrong origin/server

## Codes 422-451
HTTP 422 Unprocessable Content
curl -i -X POST https://example.com/api/users -H 'Content-Type: application/json' -d '{"email":"not-an-email"}'

# Semantically invalid content

HTTP 423 Locked
LOCK /webdav/file.txt HTTP/1.1

# Resource is locked

HTTP 424 Failed Dependency
PROPPATCH /webdav/resource HTTP/1.1

# Dependent action failed

HTTP 425 Too Early
HTTP/1.1 425 Too Early

# Replay-risk request rejected

HTTP 426 Upgrade Required
HTTP/1.1 426 Upgrade Required
Upgrade: h2c

# Client must switch protocol

HTTP 428 Precondition Required
HTTP/1.1 428 Precondition Required

# Conditional request required

HTTP 429 Too Many Requests
curl -i https://api.example.com/v1/search

# Rate limit exceeded

HTTP 431 Request Header Fields Too Large
curl -i -H 'Cookie: huge=...' https://example.com

# Headers are too large

HTTP 451 Unavailable For Legal Reasons
HTTP/1.1 451 Unavailable For Legal Reasons

# Blocked for legal reasons

Recommended next

No recommendations yet.