HTTP 406 — Not Acceptable

The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request

When to use it

Use status 406 when this is the correct HTTP response semantic: The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request

Request and response example

GET /protected-resource HTTP/1.1
Host: api.example.com

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

{"error":"Request cannot be completed"}

Related status codes

400, 401, 402, 403

References

MDN · RFC 9110