415 Unsupported Media Type

The server refuses the request because of its Content-Type (or Content-Encoding) — the body format itself, before validation even starts. Sending JSON with a text/plain header, or multipart when JSON is expected, lands here.

What usually causes it

  • Missing Content-Type: application/json on a JSON POST
  • Charset suffix confusing a strict parser (application/json; charset=utf-8 vs exact-match checks)
  • Sending form-encoded data to a JSON-only endpoint (default of many HTTP clients)

How to debug and fix it

  1. Set the Content-Type explicitly in the client; don't rely on library defaults.
  2. Compare with a working curl: -H 'Content-Type: application/json' -d '{...}'.
  3. Server-side, accept the standard charset suffix — rejecting it violates the spirit of the spec and breaks many clients.

Easily confused with