406 Not Acceptable

The server cannot produce a response matching the Accept headers on the request.

Status

HTTP/1.1 406 Not Acceptable

Details

406 is the result of failed server-driven content negotiation. The client asked for a media type, language, character set, or encoding that the server cannot supply, and the server chose to fail rather than send something the client did not ask for.

Most servers prefer to ignore an unsatisfiable Accept header and serve their default representation, so genuine 406s are rare. When one appears, the usual culprit is an over-specific Accept header generated by a client library or copied from documentation.

Common causes

How to fix it

As the client

As the server

Examples

Asking for a media type the API does not produce

HTTP request

GET /api/v2/order/40213 HTTP/1.1
Host: api.example.com
Accept: application/xml

HTTP response

HTTP/1.1 406 Not Acceptable
Content-Type: application/json; charset=utf-8

{"error":"not_acceptable","supported":["application/json"]}

Specifications

See also