# 406 Not Acceptable: requested media type not supported by server

- **ID:** `api/http-406-not-acceptable-content-negotiation`
- **Domain:** api
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The client's `Accept` header specifies a media type (e.g., `application/xml`) that the server cannot produce, causing content negotiation to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| HTTP/1.1 (RFC 7231) | active | — | — |
| Spring Boot 3.0+ | active | — | — |
| ASP.NET Core 8.0+ | active | — | — |

## Workarounds

1. **Set the `Accept` header to a supported type, typically `application/json`. Example: `curl -H "Accept: application/json" https://api.example.com/resource`.** (95% success)
   ```
   Set the `Accept` header to a supported type, typically `application/json`. Example: `curl -H "Accept: application/json" https://api.example.com/resource`.
   ```
2. **Check the server's API documentation for supported media types and update the client accordingly. Example: `GET /api/v1/resource` with `Accept: application/vnd.api+json`.** (90% success)
   ```
   Check the server's API documentation for supported media types and update the client accordingly. Example: `GET /api/v1/resource` with `Accept: application/vnd.api+json`.
   ```
3. **If you control the server, add support for the requested media type by configuring a content negotiation serializer (e.g., in Spring Boot, add `jackson-dataformat-xml` dependency).** (85% success)
   ```
   If you control the server, add support for the requested media type by configuring a content negotiation serializer (e.g., in Spring Boot, add `jackson-dataformat-xml` dependency).
   ```

## Dead Ends

- **** — The server may still default to a supported type (e.g., `application/json`), but if the client explicitly requires a type, removing the header changes behavior and may cause other issues. (60% fail)
- **** — The server must explicitly support the requested type; the error is correct. (80% fail)
- **** — While `*/*` may work, it bypasses content negotiation and may return an unexpected format. (70% fail)
