415 Unsupported Media Type

The request body's Content-Type is not one the endpoint accepts.

What 415 means

415 means the server understands the request but cannot process the format the body is in. It is about Content-Type on the request, not about what the client is willing to receive - that is 406 Not Acceptable, which is a different and much rarer response.

The commonest real cause is a missing or wrong Content-Type header rather than a genuinely unsupported format. A client sending JSON without Content-Type: application/json will get 415 from any framework that dispatches on media type, even though the body is exactly what the server wants.

Charset and parameter mismatches also trigger it. Some servers treat application/json;charset=utf-8 as distinct from application/json and reject one of them, which is technically over-strict but common enough to be worth checking.

Common causes of a 415

  • Content-Type missing entirely - very common with hand-built requests and some HTTP clients.
  • Sending application/x-www-form-urlencoded where the endpoint wants application/json, or the reverse.
  • A charset parameter the server does not expect - application/json;charset=utf-8 versus application/json.
  • A multipart upload with a malformed or missing boundary parameter.
  • A custom vendor media type (application/vnd.example+json) the server does not recognise.

How to fix a 415

  • Set Content-Type explicitly on every request with a body - do not rely on the client library's default.
  • Check whether the server is strict about the charset parameter.
  • Send an Accept-Post or Accept header on the 415 listing the media types the endpoint does accept.
  • For multipart, let your HTTP library set the boundary rather than writing the header by hand.

Headers this status expects

  • Accept-Post - lists the media types the endpoint accepts for POST, making the error actionable.

Should a client retry?

Retrying with the same Content-Type fails identically. Change the format or the header.

FAQ

What is the difference between 415 and 406?
415 is about the request body: the server cannot process the Content-Type you sent. 406 is about the response: the server cannot produce anything matching your Accept header. 415 is far more common in practice.
Why do I get 415 when my body is valid JSON?
Almost certainly a missing or wrong Content-Type header. Frameworks dispatch on media type, so JSON sent without Content-Type: application/json is rejected before anything looks at the body.
Does the charset parameter matter?
It should not, but some servers treat application/json and application/json;charset=utf-8 as different types and reject one. If you are getting 415 with a correct type, try it without the charset.

Often confused with