HTTPfy

415 Unsupported Media Type

The server does not support the request body's media type or content encoding.

415 at a glance

Code
415
Name
Unsupported Media Type
Class
4xx Client error
Status
IANA-registered standard code
Defined in
RFC 9110, Section 15.5.16
Cacheable by default
No by default. Caches store it only when the response carries explicit freshness (Cache-Control max-age, s-maxage or Expires).

What 415 means

415 Unsupported Media Type means the body's Content-Type (or Content-Encoding) is not something this endpoint accepts. If the problem is the encoding, the server should list supported ones in Accept-Encoding; for media types, it can advertise Accept-Post or Accept-Patch.

What typically causes a 415

  • Sending form data (application/x-www-form-urlencoded) to an endpoint that expects application/json.
  • Missing Content-Type header on a JSON POST; ASP.NET Core and Spring return 415 in this case.
  • PATCH with application/json when the API expects application/merge-patch+json or json-patch+json.
  • Uploading an unsupported file format.

Fix it on the server

  • List accepted types in the error body and via Accept-Post / Accept-Patch.

Fix it as a client or visitor

  • Set the header explicitly, e.g. curl -H "Content-Type: application/json" -d '{...}'.

Headers that go with 415

HeaderRole
Content-TypeThe request header that was rejected.
Accept-PostMedia types accepted by POST (W3C LDP).
Accept-PatchMedia types accepted by PATCH (RFC 5789).

Example response

HTTP/1.1 415 Unsupported Media Type
Accept-Post: application/json
Content-Type: application/json

{"error": "Content-Type must be application/json"}

Opens the HTTP headers tool with your URL filled in; it shows the status line and headers of every redirect hop.