415 Unsupported Media Type
The 415 Unsupported Media Type status code indicates the client made a request with a Content-Type or Content-Encoding that is unknown or invalid for the resource.
Writing responses (servers)
Servers should produce 415 Unsupported Media Type
in two cases:
Unknown Content-Encoding
If the resource exists and the request is understood and authorized, but the server does not understand the Content-Encoding applied to the message, then return 415 Unsupported Media Type
and an Accept-Encoding header listing the content codings that the server is capable of decoding.
Unknown Content-Type
If the resource exists and the request is understood and authorized, and the server understands the content coding, but does not understand the request Content-Type, or the request Content-Type is not valid for the resource, then return 415 Unsupported Media Type
along with a message describing acceptable media types.
Unexpected message body
If the method/resource does not permit a message body at all, see 413 Payload Too Large instead.
Reading responses (clients)
Clients should handle 415 Unsupported Media Type
with the following process:
- Look for an Accept-Encoding header. If present, and the initial coding does not appear, re-make the request with a different Content-Encoding from codings listed in Accept-Encoding.
- Otherwise, re-make the request with a different Content-Type and/or method. Show the user the returned error page and prompt them to re-make the request with a different upload media type.
If the request is a PATCH request, look for the Accept-Patch header. If present, and the attempted media type does not appear in this list, try to re-make the request with one of the listed media types.
Overview table
- Name
- 415
- Message
- 415 Unsupported Media Type
- Description
- The Content-Encoding or Content-Type is not acceptable.
- Specification
- RFC 7231: HTTP/1.1 Semantics and Content ยง6.5.13. 415 Unsupported Media Type
Example
HTTP/1.1 415 Unsupported Media Type