406 Not Acceptable β
Meaning β
The server cannot generate a response that is acceptable according to the Accept headers sent in the request.
When to Use β
When content negotiation fails: the clientβs Accept (or similar) headers specify a response format that the server cannot fulfill, so no suitable representation is available.
Example β
A client requests /data with Accept: text/xml, but the server only produces JSON; it returns 406 Not Acceptable to indicate it cannot provide content in the requested format.
When Not to Use β
Do not use if the server chooses to ignore the Accept header and send a default format (then 200 could be used). Only use 406 when the server actively honors Accept headers and finds no match.
Source β
RFC 9110