Error Codes Wiki

HTTP Content Negotiation — 406 Not Acceptable and Accept Header Errors

Warning4xx client error

Overview

Fix HTTP 406 Not Acceptable errors caused by content negotiation failures when the server cannot produce a response matching the client's Accept headers.

Key Details

  • Content negotiation allows clients to request specific formats via Accept, Accept-Language, Accept-Encoding headers
  • HTTP 406 Not Acceptable means the server cannot produce a response matching any of the client's acceptable formats
  • Server-driven negotiation uses client headers; agent-driven negotiation uses 300 Multiple Choices
  • The Accept header specifies media types: application/json, text/html, image/webp, etc.
  • Quality values (q=0.9) let clients express preference ordering

Common Causes

  • Client requesting a format the server does not support (e.g., Accept: application/xml on a JSON-only API)
  • Overly restrictive Accept header excluding the server's available formats
  • API versioning via Accept header with an unsupported version string
  • Misconfigured reverse proxy stripping or modifying Accept headers

Steps

  1. 1Check which formats the API supports in its documentation
  2. 2Set Accept: */* to accept any format, or Accept: application/json, text/html for common web formats
  3. 3If using API versioning via Accept header, verify the version string matches supported versions
  4. 4Test the request with curl adding -H 'Accept: application/json' to isolate the issue
  5. 5Check proxy and CDN configuration to ensure Accept headers are forwarded correctly

Tags

content-negotiation406accept-headermedia-typenot-acceptable

Related Items

More in 4xx Client Error

Frequently Asked Questions

It means the client accepts any media type. This is the most permissive Accept value and should never trigger a 406 response.