DevKits
406

Not Acceptable

4xx Client Error

Last updated:

The server cannot produce a response matching the Accept headers sent by the client.

Description

Content negotiation failure. If the client requires application/xml but your endpoint only serves JSON, return 406.

When to use

Rarely returned in modern APIs — most APIs simply serve what they have. Use it if you strictly enforce Accept headers.

Specification

RFC 9110 §15.5.7

Examples

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

{"error":"Not Acceptable"}
Node.js (Express)
res.status(406).json({ error: "Not Acceptable" });
Go (net/http)
w.WriteHeader(http.StatusNotAcceptable)
Python (Flask)
return jsonify({"error": "Not Acceptable"}), 406

Related status codes

All 4xx codes