406 Not Acceptable
The server cannot produce a representation that matches the Accept headers the client sent.
At a glance
- Status code
- 406 Not Acceptable
- Class
- 4xx, client error, the request itself is the problem
- Defined in
- RFC 9110
- Cacheable by default
- yes
- Response body
- Optional list of the representations that are available.
In detail
Content negotiation failed. The client asked for, say, application/xml, and the endpoint can only produce JSON.
The specification explicitly allows a server to ignore the Accept header and send its preferred representation instead, which most APIs do. That is usually kinder than a hard 406.
Check the exact Accept header the client sent. A generated client library that sends Accept: application/vnd.example.v2+json against a server expecting application/json is the usual cause.
Examples
HTTP/1.1 406 Not Acceptable
Content-Type: application/json
{"available":["application/json"]}Things that catch people out
- Accept-Language mismatches also produce 406. Returning the default language is almost always better than refusing.
- 406 is easy to trigger accidentally with a strict media type check that does not tolerate parameters like charset.
Try it: HTTP Request Builder
Build a request with any method, headers and body, send it, and read the status line the server returns.
HTTP Request Builder
LOCAL · Browser-OnlyBuild and test HTTP requests with custom headers and body
Authentication
Headers
Generate Code
curl -X GET 'https://api.example.com/endpoint' \
-H 'Content-Type: application/json'Showing a sample URL. Enter your endpoint above to update the snippet.
Related HTTP status codes
All http status codes →415 Unsupported Media Type
The server refuses the request because the body is in a format it cannot handle, as declared by Content-Type.
300 Multiple Choices
The request matched more than one representation and the server is asking the client to pick, rather than choosing for it.
400 Bad Request
The server refused the request because it was malformed. The client must change something before retrying, because repeating the same bytes will fail.
407 Proxy Authentication Required
A proxy between the client and the server needs credentials. This is 401 raised by the intermediary rather than by the origin.
408 Request Timeout
The server gave up waiting for the client to finish sending the request and closed the idle connection.
409 Conflict
The request clashes with the current state of the resource, for example an edit based on a version that has since changed.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL