Skip to content
HTTP 406 Not Acceptable — What It Means & How to Fix

HTTP 406 Not Acceptable — What It Means & How to Fix

DodaTech Updated Jun 20, 2026 5 min read

HTTP 406 Not Acceptable means the server cannot produce a response matching the Accept headers sent by the client — content negotiation failure.

What It Means

The HTTP 406 Not Acceptable status code is the result of failed content negotiation. When a client sends a request with an Accept header specifying which media types, languages, or character sets it can handle, the server checks if it can produce a response matching those preferences. If none of the available representations match, the server returns 406.

Content negotiation is the process where the client and server agree on the best representation of a resource. The client communicates its preferences through headers like:

  • Accept — which MIME types are acceptable (e.g., application/json, text/html, image/webp)
  • Accept-Language — preferred languages (e.g., en-US, fr-FR)
  • Accept-Charset — character encodings (e.g., utf-8)
  • Accept-Encoding — compression algorithms (e.g., gzip, br)

A 406 response may optionally include a list of available representations in the body so the client can choose an alternative. In practice, many servers return 406 with an error message describing which formats are supported.

When It’s Sent

  • Wrong Accept header — a client sends Accept: application/xml but the API only supports JSON
  • Missing language variant — a client requests Accept-Language: es-MX but the site only has en and fr
  • API version mismatch — a client specifies an unsupported content type for a specific endpoint version
  • Static file negotiation — a server offers a file in multiple formats but the requested format is unavailable
  • Custom media type error — a client sends Accept: application/vnd.api+json but the server doesn’t recognize it

Real Example

curl -v -H "Accept: application/xml" https://api.example.com/users/1

Expected response:

> GET /users/1 HTTP/1.1
> Host: api.example.com
> Accept: application/xml
>
< HTTP/1.1 406 Not Acceptable
< Content-Type: application/json
< Content-Length: 103
<
{"error":"not_acceptable","message":"This API only supports application/json","available_types":["application/json"]}

The server clearly states that only application/json is available. The client can retry with the correct Accept header.

How to Debug

Client-Side

  1. Check the Accept header — verify you are sending the correct MIME type for the endpoint
  2. Review API documentation — confirm which content types the endpoint supports
  3. Remove restrictive Accept headers — try without Accept or use Accept: */* to see the default response
  4. Check Accept-Language — if the server doesn’t support your language, try Accept-Language: *
  5. Inspect the response body — many APIs list the supported formats in the error response

Server-Side

  1. Review content negotiation logic — check how your framework resolves Accept headers
  2. Verify registered renderers — in frameworks like Rails or Django REST, ensure the correct renderers are configured
  3. Check the supported formats list — make sure the endpoint advertises its available formats
  4. Test with no Accept header — the server should have a default format it returns
  5. Review middleware — some middleware may override or strip content negotiation headers

curl

# Request a specific format
curl -s -w "\nHTTP: %{http_code}\n" \
  -H "Accept: text/csv" https://api.example.com/report

# Check what formats the server offers (use OPTIONS or no Accept header)
curl -s -D - https://api.example.com/report | head -20

Postman

Set the Accept header in the Headers tab. Try with Accept: application/json and Accept: text/csv to compare responses. The status badge changes between 200 and 406 depending on supported formats.

Common Causes

ScenarioWhat HappensWhy It Matters
Wrong media typeClient requests XML, server only serves JSONUpdate the client’s Accept header
Missing language variantClient requests Spanish, server only has EnglishAdd language support or return a fallback
Unsupported API versionClient uses application/vnd.api.v2+json but server only has v1Check API versioning documentation
Custom content typeClient uses a vendor-specific MIME type the server doesn’t recognizeUse standard MIME types or register the custom type
Framework misconfigurationDjango/Rails/Express isn’t configured to render the requested formatAdd the appropriate renderer or serializer

FAQ

What is the difference between 406 and 415?
406 Not Acceptable is about the response format — the client uses Accept headers to specify what it wants to receive, and the server cannot comply. 415 Unsupported Media Type is about the request format — the client sends a Content-Type the server cannot process. Both are content negotiation failures but in opposite directions.
Should a server always return 406 or should it fall back to a default format?
Best practice is to return a default format when the client does not specify a restrictive Accept header. But if the client explicitly asks for an unsupported format, 406 is the correct response. Some APIs choose to return 200 OK with the default format regardless — this is pragmatic but technically less correct.
How do I fix a 406 error in a browser?
Browsers typically send Accept: text/html,application/xhtml+xml,... and rarely trigger 406 for regular pages. If you see 406 in a browser, it is usually caused by an extension or developer tool modifying the Accept header. Try disabling extensions, clearing the cache, or testing in an incognito window. If the issue is on the server side, check your web server’s content negotiation configuration.

Related Codes

  • HTTP 200 OK — successful response with the correctly negotiated format
  • HTTP 415 Unsupported Media Type — server cannot process the request’s Content-Type
  • HTTP 404 Not Found — resource does not exist regardless of format
  • HTTP 500 Internal Server Error — server error during content negotiation

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro