# 415 Unsupported Media Type

> https://http-status.org/docs/415

**Family:** 4xx Client Error

## Rationale

The request payload's media type is not supported by the server or resource.

## In Plain Terms

I don't understand the format of data you sent me. Please send it as JSON, XML, or another format I support.

## Description

The HTTP 415 Unsupported Media Type status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.

## Server Perspective

### Usage
- Return 415 for unsupported Content-Type values or unsupported request encodings
- Use it when the server rejects the format of the incoming content, not the desired response format
- Request Content-Type not supported
- Sending XML to JSON-only endpoint
- Incorrect file upload format
- Missing or wrong Content-Type header

### Implementation
- Tell the client which media types or encodings are supported
- Keep 415 distinct from 406, which is about the response representation

### Common Headers
- Accept-Post — include this when the rejected request is a POST to advertise which media types the endpoint accepts.
- No other status-specific header is required; still send normal HTTP metadata such as Content-Type, caching, or tracing headers when they help the client.

### Body
- Include supported media types or encodings when the client can retry in another format.

### Pitfalls
- Do not use 415 when the request body parsed fine but failed semantic validation
- Do not use 415 for response-format negotiation problems
- Response format negotiation (use 406 Not Acceptable)
- Bad request structure (use 400 Bad Request)
- Authentication required (use 401 Unauthorized)

## Client Perspective

### Pitfalls
- Do not treat 415 like a generic bad body error when the problem is specifically media type support

## Examples

### XML sent to JSON endpoint

Endpoint only accepts JSON, not XML payloads

**Request:**
```
POST https://api.example.test/api/users
Content-Type: application/xml
```

**Response:**
```
415 Unsupported Media Type
Content-Type: application/json

{
  "error": "unsupported_media_type"
}
```

## Related Codes

- [406 Not Acceptable](/docs/406.md)

