Skip to content
HTTP 415 Unsupported Media Type — What It Means & How to Fix

HTTP 415 Unsupported Media Type — What It Means & How to Fix

DodaTech Updated Jun 20, 2026 4 min read

HTTP 415 Unsupported Media Type is an HTTP response status code that indicates the server refuses to accept the request because the payload format is in an unsupported media type. The Content-Type header sent by the client does not match any format the endpoint is configured to accept.

What It Means

Defined in RFC 7231 Section 6.5.13, the 415 status code is the server’s way of saying: “I don’t understand this format. Send it in a format I support.” REST APIs commonly accept JSON (application/json) or form data (application/x-www-form-urlencoded), and returning 415 when receiving XML or plain text.

The server may include an Accept-Post or Accept-Patch header in the response indicating which media types are supported.

When It’s Sent

  • Wrong Content-Type header — Sending text/xml when the API expects application/json.
  • File upload with wrong MIME type — Uploading a .txt file when the endpoint expects .csv.
  • Legacy API versions — An old endpoint that only accepts XML receives JSON.
  • Missing Content-Type header — The client sends the request without setting Content-Type.
  • Binary vs text mismatch — Sending application/octet-stream when the endpoint expects multipart/form-data.

Real Example

The following curl command sends a request with the wrong content type:

curl -X POST https://httpbin.org/post \
  -H "Content-Type: text/plain" \
  -d '{"key": "value"}' \
  -w "\nHTTP Status: %{http_code}\n"

Expected response:

HTTP/1.1 415 UNSUPPORTED MEDIA TYPE
Date: Sat, 20 Jun 2026 12:00:00 GMT
Content-Type: application/json
Content-Length: 101

{
  "error": "Unsupported Media Type",
  "message": "Content-Type 'text/plain' is not supported. Use application/json."
}

How to Debug & Fix

Client-Side

  1. Set the correct Content-Type — Check API documentation and set Content-Type: application/json for JSON APIs.
  2. Verify the request body format — Ensure the body matches the declared Content-Type. Sending XML with Content-Type: application/json will fail.
  3. Use the right multipart encoding — For file uploads, use Content-Type: multipart/form-data with a boundary.
  4. Check Accept header too — Some servers check both Content-Type (what you send) and Accept (what you want back).

Server-Side

  1. List supported types in the response — Include an Accept-Post header listing accepted media types.
  2. Support content negotiation — Implement proper content negotiation using the Accept header.
  3. Add a middleware check — Validate Content-Type early in the request pipeline before processing.
  4. Return a descriptive error — Tell the client exactly which media types are supported.

Common Causes Table

ScenarioLikely CauseHow to Fix
API returns 415 for JSONEndpoint expects application/json but client sends text/plainSet Content-Type: application/json
File upload failsMIME type mismatch between file and expected typeValidate the file extension and set proper MIME
Postman request failsDefault Content-Type in Postman is text/plainChange to application/json in the Headers tab
Curl command failsCurl does not set Content-Type by defaultAdd -H "Content-Type: application/json"
Legacy API migrationAPI upgraded from XML to JSON but client still sends XMLUpdate client to send JSON

FAQ

What is the difference between 415 and 400?
A 400 Bad Request is a general error for malformed syntax. A 415 is specifically about the media type being unsupported — the syntax may be fine, but the format itself is rejected.
Does 415 also apply to the Accept header?
Strictly, no. If the server cannot produce a response in the format requested by the Accept header, it returns 406 Not Acceptable. The 415 is for the request body’s Content-Type.
Can a server return 415 for missing Content-Type?
Yes. If the server requires a specific Content-Type and the header is absent, returning 415 is correct behavior since the server cannot determine how to parse the body.

Related Codes

HTTP 406 Not Acceptable — The server cannot produce a response in the client’s requested format.

HTTP 400 Bad Request — General client error for malformed requests.

HTTP 422 Unprocessable Entity — The format is correct but the content has semantic errors.

HTTP 501 Not Implemented — The server does not support the functionality needed.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro