415 Unsupported Media Type

The HTTP 415 Unsupported Media Type client error response status code indicates that the server refused to accept the request because the payload format is not supported.

The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of processing the request payload. Some servers may be strict about the expected Content-Type of requests. For example, sending UTF8 instead of UTF-8 to specify the UTF-8 charset may cause the server to consider the media type invalid.

Status

http
415 Unsupported Media Type

Examples

Missing content type

In the following example, the Content-Type header is missing entirely:

http
POST /comments HTTP/1.1
Host: example.com
Content-Length: 23

{
  "user": "belgin",
  "comment": "LGTM!"
}

If the server implementation expects at least a MIME type Content-Type: application/json; for the request at that endpoint, it may send the following response:

http
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 28 Jun 2024 12:00:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Accept-Post: application/json; charset=UTF-8
Content-Length: 0

Invalid content type

In the following example, the Content-Type header is incorrectly set to URL-encoded form data when the payload is in the request body instead:

http
POST /comments HTTP/1.1
Host: example.com
Content-Length: 23
Content-Type: application/x-www-form-urlencoded

{
  "user": "belgin",
  "comment": "LGTM!"
}

In this case, the server responds with a 415, with the required content type for the request in the Accept-Post header:

http
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 28 Jun 2024 12:00:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Accept-Post: application/json; charset=UTF-8
Content-Length: 0

Specifications

Specification
HTTP Semantics
# status.415

See also