HTTP Status Codes / 4xx HTTP Status Codes / HTTP 415

415 Unsupported Media Type

This is an educational reference page about HTTP 415 Unsupported Media Type. The page itself is served as 200 OK so it can be indexed as HTTP documentation.

The server refuses the request because the content is in a format this method on the target resource does not support.

Specification

Registered in the IANA HTTP Status Code Registry as Unsupported Media Type. Defined in RFC 9110, Section 15.5.16.

What it means

HTTP 415 Unsupported Media Type means the server will not process the request body because of its format. The problem can come from the Content-Type header, the Content-Encoding header, or the server inspecting the data itself. RFC 9110 suggests an Accept response header to list the media types the server would accept, or Accept-Encoding for content codings.

When to use it

Common causes

Headers involved

How to fix it

Examples

JSON sent without a JSON Content-Type

POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: text/plain;charset=UTF-8

{
  "email": "ada@example.com"
}

HTTP/1.1 415 Unsupported Media Type
Accept: application/json
Content-Type: application/json

{
  "error": "Send the body as application/json."
}

Common mistakes

Developer notes

406 and 415 mirror each other. 415 is about the request body the client sent. 406 is about the response format the client asked for in Accept.

Questions

What does HTTP 415 Unsupported Media Type mean?

HTTP 415 means the server will not accept the request body in its current format, usually because of the Content-Type or Content-Encoding.

How do I fix 415 when sending JSON?

Set the Content-Type request header to application/json and send a JSON body.

What is the difference between 415 and 406?

415 means the server cannot accept the format the client sent. 406 means the server cannot produce a format the client asked for.

See also

Header and content rules

What RFC 9110 says about a 415 response, quoted from the RFC. The 4xx class rules also apply.

The same rules are in the response obligations table and its JSON.

4xx client error – the request contains bad syntax or cannot be fulfilled


HTTP status code lookup
REST API status code chooser
cURL command generator
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia