// http 4xx · client error

HTTP 406 Not Acceptable

Can't produce a response matching the Accept headers.

What HTTP 406 Not Acceptable means

406 Not Acceptable means the server can't produce a response in any format the client said it would accept via the `Accept` header. It's rare in practice — most servers fall back to a default format instead.

Which category is it?

406 is a 4xx code — Client error. 4xx means the request has a problem the client must fix — bad syntax, missing authentication, or a resource that isn't there. It's the caller's responsibility.

Common causes

  • `Accept` header requests a format the server can't produce
  • Overly strict content negotiation

How to fix it

  • Relax or correct the `Accept` header
  • Request a format the server supports (e.g. `application/json`)

Example 406 response

GET /report HTTP/1.1
Accept: application/xml

HTTP/1.1 406 Not Acceptable
Content-Type: application/json

{"error":"Supported types: application/json"}

How to diagnose a 406

  1. Look at the request's Accept header (browser dev tools, or curl -v). It lists the formats the client says it can handle.
  2. Compare it with what the endpoint can return. If the server only produces JSON and the client demands only XML, the server answers 406.
  3. Check Accept-Language, Accept-Charset and Accept-Encoding too. Strict negotiation on any of them can trigger a 406.
  4. Also check framework or WAF rules: some security layers reject requests whose Accept header looks unusual.

406 compared with similar codes

  • 415: 415 is about the format of the body you send (Content-Type). 406 is about the format of the response you asked for (Accept).
  • 400: A 400 means the request itself is malformed. A 406 means the request is fine but the server cannot produce an acceptable representation.

406 Not Acceptable: common questions

How do I fix a 406 Not Acceptable error?

Send an Accept header the server can satisfy (for APIs usually application/json), or add */* as a fallback. If you run the server, return a default representation instead of 406 unless strict negotiation is required.

Why do I get 406 only from some clients?

Different clients send different Accept headers. A browser sends a long list that usually includes */*, while scripts and tools may send a single narrow type.

Other client error (4xx) codes