What 415 means
The server won’t accept the request because the body is in a format it doesn’t support, usually judged by the Content-Type header, or because of its Content-Encoding.
When servers send it
For POST, PUT and PATCH requests with a missing or unexpected Content-Type.
Common causes
- Sending JSON without
Content-Type: application/json. - Sending form data to an endpoint that only reads JSON (or the other way round).
- Compressing the request body with an encoding the server doesn’t accept.
- A typo such as
application/jsom.
How to fix it as a developer
- Set
Content-Type: application/jsonwhen sending JSON. With fetch, add it to theheaders. - Servers can add an
AcceptorAccept-Encodingheader to the 415 response to say what they do support.
How to fix it as a visitor
- This is a problem with the site or app, not you. Let them know if it keeps happening.
Related codes
- 406 Not Acceptable: The server can’t produce a response in any format the Accept headers allow.
- 400 Bad Request: The server can’t or won’t handle the request because something in it is malformed.
- 422 Unprocessable Content: The request is well formed, but the data in it doesn’t make sense, such as failing validation.
Where it’s defined
415 Unsupported Media Type is defined in RFC 9110, section 15.5.16. It’s a 4xx code, the client error class: something is wrong with the request, so sending it again unchanged won’t help.
Other 4xx codes
400 Bad Request · 401 Unauthorized · 402 Payment Required · 403 Forbidden · 404 Not Found · 405 Method Not Allowed · 406 Not Acceptable · 408 Request Timeout · 409 Conflict · 410 Gone · 413 Content Too Large · 414 URI Too Long · 418 I’m a teapot · 422 Unprocessable Content · 429 Too Many Requests · 431 Request Header Fields Too Large · 451 Unavailable For Legal Reasons · 499 Client Closed Request
Or search them all in the HTTP status code list.
Questions people ask
What does HTTP 415 Unsupported Media Type mean?
Why does my fetch POST get a 415?
Content-Type header is missing. fetch sends a string body as text/plain by default, so set headers: { "Content-Type": "application/json" }.What’s the difference between 415 and 406?
Content-Type). 406 is about what you’ll accept back (your Accept header).