HTTP 415 Unsupported Media Type
Updated Free mock REST & WebSocket APIs
HTTP 415 Unsupported Media Type — The server refuses the request because the body's format (Content-Type) isn't supported.
- Class
- 4xx Client Error
- Defined in
- RFC 9110 §15.5.16
- Official
- Yes (IANA registry)
- Cacheable by default
- No (unless Cache-Control/Expires say so)
- Safe to retry
- Not without changing the request
Try it: get a real 415 response
Our test endpoint answers every request with 415 Unsupported Media Type.
curl -i https://mockfox.dev/api/status/415Use it in tests, health-check monitors or to see how your client handles a 415. Add ?delay=2000 to slow it down.
What does HTTP 415 mean?
415 Unsupported Media Type means the server refuses the request because the body is in a format the endpoint doesn't support. The server looks at the Content-Type (and sometimes Content-Encoding) header — or the data itself — and doesn't accept it.
The server may include an Accept header (for POST) or Accept-Patch header (for PATCH) listing the formats it does accept.
When is 415 used?
- Sending JSON without
Content-Type: application/json(e.g. astext/plainor form data). - Uploading a file type the endpoint doesn't accept (an image API receiving a PDF).
- Using
application/merge-patch+jsonwhere onlyapplication/json-patch+jsonis supported, or vice versa. - Sending a gzip-encoded body to a server that doesn't decode
Content-Encoding: gzip.
Common causes of a 415
- A missing or wrong
Content-Typeheader — by far the most common cause. - fetch() sends a string body as
text/plain;charset=UTF-8unless you set the header. - ASP.NET Core and Spring return 415 when a
[FromBody]/@RequestBodyendpoint gets a content type it has no formatter for.
How to fix 415 Unsupported Media Type
If you're visiting the site
- Check that the file you're uploading is in a supported format (e.g. JPG/PNG instead of HEIC or WebP).
- Convert the file and try again.
If you run the site or API (developers)
- Set the right header:
Content-Type: application/jsonfor JSON,multipart/form-datafor file uploads (let the browser set the boundary — don't set it manually with FormData). - On the server, return 415 with an
Acceptheader listing supported types. - Use 400 for a body that claims to be JSON but isn't parseable; use 415 when the type itself is unsupported.
Returning or handling 415: server examples
fetch (client fix)
await fetch("/api/items", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: "Widget" }),
});
// File uploads: don't set Content-Type yourself
const form = new FormData();
form.append("file", file);
await fetch("/api/upload", { method: "POST", body: form });Express
app.post("/api/items", (req, res, next) => {
if (!req.is("application/json"))
return res.status(415).set("Accept", "application/json").json({ error: "unsupported_media_type" });
next();
}, createItem);Next.js
// app/api/example/route.ts (Next.js App Router)
export async function POST(req: Request) {
if (!req.headers.get("content-type")?.includes("application/json"))
return Response.json({ error: "Send application/json" }, { status: 415, headers: { Accept: "application/json" } });
const body = await req.json();
// ...
}Example 415 response
HTTP/1.1 415 Unsupported Media Type
Accept: application/json
Content-Type: application/json
{"error":"unsupported_media_type","message":"Send the body as application/json"}Related status codes
- 400 Bad RequestThe server can't process the request because it's malformed or invalid.
- 406 Not AcceptableThe server can't produce a response matching the client's Accept headers.
- 422 Unprocessable ContentThe request is well-formed, but its contents fail validation.
Related tools
Frequently asked questions
How do I fix 415 Unsupported Media Type in Postman?
In the Body tab choose raw → JSON (which sets Content-Type: application/json), or set the Content-Type header manually to what the API expects.
What's the difference between 415 and 406?
415 is about the format of what you send (Content-Type). 406 is about the format you ask to receive (Accept).
Why does my Spring or ASP.NET endpoint return 415?
The framework couldn't find a converter for the request's Content-Type — usually the header is missing or set to text/plain. Send application/json, or adjust the endpoint's consumes/Consumes attribute.