Runs in your browser. Your files and text never leave your device - nothing is uploaded.
4xx Client Error
What it means
The server refuses the request because the payload format (Content-Type) isn't supported.
| Property | Detail |
|---|---|
| Status class | 4xx Client Error |
| Defined in | RFC 9110, Section 15.5.16 |
| Cacheable by default | Only with explicit caching headers: a cache stores it when the response carries Cache-Control (max-age, s-maxage or public) or Expires. |
| Who needs to act | The client, which has to send a supported format. |
What does HTTP 415 Unsupported Media Type mean?
HTTP 415 Unsupported Media Type means the server refuses the request because the body is in a format it does not support for that method and URL. The usual cause is a missing or wrong Content-Type header, such as JSON labelled as text/plain. It can also mean the body uses a Content-Encoding the server cannot decode.
How 415 Unsupported Media Type works
The server can decide the format is unsupported from the Content-Type header, from the Content-Encoding header, or by inspecting the data itself. RFC 9110 suggests helping the client: if the media type was the problem, the response can carry an Accept header listing the types the server would take, and if a content coding such as gzip was the problem, an Accept-Encoding header can list the codings it accepts. A 415 differs from 400 and 422 in timing: the server rejects the format before it attempts to parse the content.
Example 415 request and response
POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: text/plain;charset=UTF-8
HTTP/1.1 415 Unsupported Media Type
Accept: application/jsonThe JSON body was labelled as plain text, so the server refused it and listed the type it accepts.
What causes a 415 Unsupported Media Type
- Calling fetch() with a JSON string body but no Content-Type header, so it is sent as text/plain.
- Posting multipart/form-data or URL-encoded form data to an endpoint that only accepts application/json.
- Uploading a file type the endpoint does not allow, such as HEIC to an image API that wants JPEG or PNG.
- Compressing the request body with an encoding the server cannot decode.
How to fix a 415 Unsupported Media Type
If you sent the request
- Set Content-Type to what the API documents, usually application/json, and make sure the body really is in that format.
- In fetch(), pass headers: { 'Content-Type': 'application/json' } alongside JSON.stringify(body).
- Convert files to a supported format before uploading.
If you build the API
- Return Accept or Accept-Encoding headers listing what you support.
- Reject unsupported types before parsing, and document the accepted formats.
Related status codes
- 400 Bad Request: The format is accepted, but the body is malformed.
- 422 Unprocessable Entity: The format and syntax are fine, but the content fails validation.
- 406 Not Acceptable: The reverse direction: the server cannot produce a response in a format the client accepts.
Tools that help
- HEIC to JPG converts iPhone photos into a format most upload forms accept.
- Image Format Converter switches images between JPG, PNG and WebP.
Frequently asked questions
The server refuses the request because the payload format (Content-Type) isn't supported.
Sending XML to an endpoint that expects JSON, or omitting/mismatching the Content-Type header.
Set the correct Content-Type header (e.g. application/json) matching the format of your request body.
A 415 is about what the client sent: the format of the request body is not accepted. A 406 is about what the client wants back: none of the formats in its Accept header can be produced. One is fixed with Content-Type, the other with Accept.
Sources
Other 4xx Client Error codes
Reviewed by Raja Jahangir · Last reviewed: October 7, 2026
