← All status codes4xx – Client Error

HTTP 406 – Not Acceptable

The server cannot produce a response matching the list of acceptable values in the request headers.

Common use case

Triggered when a client's Accept header requests a content type or language the server simply cannot generate, e.g. asking for XML from a JSON-only API.

Example

HTTP/1.1 406 Not Acceptable

{"error":"Only application/json is supported"}

History

Part of HTTP/1.1 (RFC 2068, 1997).

Did you know?

In practice it is rarely returned - most APIs simply ignore an unsupported Accept header and return their default format instead of failing the request.