Error Codes Wiki

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

Error4xx client error

Overview

The HTTP 415 Unsupported Media Type status code indicates the server refuses the request because the content type or encoding is not supported.

Key Details

  • This occurs when the Content-Type header in the request does not match what the server expects.
  • Common when sending JSON to an endpoint that expects form data, or vice versa.
  • The server should indicate which content types are accepted.
  • Check both Content-Type and Content-Encoding headers.

Common Causes

  • Sending application/json when the server expects application/x-www-form-urlencoded.
  • Missing Content-Type header on a POST or PUT request.
  • Using an unsupported content encoding.
  • Sending XML to a JSON-only API endpoint.

Steps

  1. 1Check the API documentation for the expected Content-Type.
  2. 2Set the correct Content-Type header in your request.
  3. 3Ensure the request body format matches the Content-Type header.
  4. 4Try common content types: application/json, application/x-www-form-urlencoded, multipart/form-data.

Tags

httpclient-errormedia-typecontent-type

Related Items

More in 4xx Client Error

Frequently Asked Questions

It means the server does not support the content type specified in your request. Check the Content-Type header and ensure it matches what the API expects.