4xx
406 Not Acceptable
The server cannot produce a response matching the client's Accept headers.
What is HTTP 406?
This status code means the server cannot generate a response that matches the content negotiation criteria specified by the client's Accept, Accept-Language, Accept-Encoding, or Accept-Charset headers. The server looked at what the client is willing to accept and has no representation that satisfies those constraints. In practice many servers ignore unacceptable Accept headers and return a default representation instead.
Defined in RFC 9110
Common Causes
- The Accept header requests a format the server does not support, such as application/xml when only JSON is available
- Language negotiation failure where the requested language version does not exist
- Strict content negotiation settings that reject requests for unsupported media types
How to Fix
- Broaden your Accept headers to include formats the server supports
- Remove restrictive Accept headers to let the server choose a default representation
- Check the API documentation for supported content types and adjust your request accordingly