What Is a 406 Status Code?

The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request1, and the server is unwilling to supply a default representation.

The server SHOULD generate a payload containing a list of available representation characteristics and corresponding resource identifiers from which the user or user agent can choose the one most appropriate. A user agent MAY automatically select the most appropriate choice from that list. However, this specification does not define any standard for such automatic selection, as described in RFC7231 Section 6.4.1.


Rails HTTP Status Symbol :not_acceptable

Go HTTP Status Constant http.StatusNotAcceptable

Symfony HTTP Status Constant Response::HTTP_NOT_ACCEPTABLE

Python2 HTTP Status Constant httplib.NOT_ACCEPTABLE

Python3+ HTTP Status Constant http.client.NOT_ACCEPTABLE

Python3.5+ HTTP Status Constant http.HTTPStatus.NOT_ACCEPTABLE

.NET HttpStatusCode.NotAcceptable

Rust http::StatusCode::NOT_ACCEPTABLE

Java java.net.HttpURLConnection.HTTP_NOT_ACCEPTABLE

Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_NOT_ACCEPTABLE

Angular @angular/common/http/HttpStatusCode.NotAcceptable

406 status code example

Here is an example of a request and response that might result in a 406 Not Acceptable status code:


GET /products HTTP/1.1
Host: example.com
Accept: application/xml

In this example, the client is requesting the “products” resource from the server, and is specifying that it would like to receive the response in XML format.


HTTP/1.1 406 Not Acceptable
Content-Type: text/plain
Content-Length: 56

The server cannot produce a response matching the request.

In this example, the server is unable to fulfill the request as the client has specified an Accept header requesting a format that the server is unable to produce. The server responds with a 406 Not Acceptable status code, indicating to the client that the request could not be fulfilled in the specified format.

What causes a 406 status code?

A 406 Not Acceptable status code is typically caused by one of the following reasons:

  • Requested resource not available in the requested format: The client may have requested a resource (such as a file or web page) in a format that is not available on the server.
  • Unsupported Accept header: The client’s request may include an “Accept” header that specifies the desired response format. If the server cannot provide a response in that format, it will return a 406 status code.
  • Unsupported character encoding: If the client request includes a “Content-Type” header that specifies a character encoding that is not supported by the server, it may return a 406 error.
  • Mismatched request and response content types: The server may be unable to provide a response in the requested format due to a mismatch between the content types specified in the client’s request and the server’s response.

In general, a 406 error occurs when the server cannot fulfill the client’s request due to a problem with the requested resource, the request headers, or the server configuration.

How to fix a 406 status code

A 406 Not Acceptable status code means that the server is unable to provide a response that matches the client’s requested format, typically specified in the Accept header of the request. Here are a few ways to potentially resolve a 406 error:

  • Update the Accept header: If the client specifies an Accept header in the request, it’s possible that the server doesn’t support the requested format. Try updating the Accept header to a different format or removing it altogether and see if that resolves the issue.
  • Check the server configuration: The server may not have the necessary components or configuration to provide a response in the requested format. Check the server logs and configuration to ensure that it’s capable of producing the desired response.
  • Provide additional parameters: Depending on the specific use case, it may be possible to modify the request to include additional parameters that allow the server to provide a response in the desired format. For example, some APIs allow clients to specify additional parameters in the request URL to specify the response format.
  • Contact the server administrator: If you’ve tried the above steps and the error persists, it’s possible that the server administrator may need to make changes to the server configuration or update the API documentation to support the desired response format. Contact the administrator or the API provider for further assistance.

Does a 406 status code affect search engine optimization (SEO)?

A 406 Not Acceptable status code can potentially impact SEO if it is preventing search engines from accessing or properly indexing the affected resource.

If search engines are unable to access or index a resource due to a 406 error, it could negatively impact the visibility and ranking of the affected page or site in search engine results pages (SERPs). This can ultimately result in decreased traffic and visibility for the affected site.

Additionally, if users are encountering 406 errors when trying to access certain resources on a site, they may be less likely to continue using or recommending the site, which could have indirect effects on SEO as well.

Additional resources

Return to List of HTTP Status Codes