Skip to content
415

Unsupported Media Type

Client Error (4xx)

The 415 Unsupported Media Type status code indicates that the server refuses to accept the request because the payload format is not supported. This typically means the Content-Type header does not match what the server expects. For example, sending XML to an endpoint that only accepts JSON, or uploading an unsupported file format.

What is HTTP 415 Unsupported Media Type?

HTTP 415 Unsupported Media Type is a client error (4xx) status code. The 415 Unsupported Media Type status code indicates that the server refuses to accept the request because the payload format is not supported. This typically means the Content-Type header does not match what the server expects. For example, sending XML to an endpoint that only accepts JSON, or uploading an unsupported file format. Common causes include missing content-type header on post/put request and sending application/xml when only application/json is accepted. To fix it, set the correct content-type header (e.g., application/json).

Example Response

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

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

Common Causes

How to Fix

  1. 1. Set the correct Content-Type header (e.g., application/json)
  2. 2. Check API documentation for supported media types
  3. 3. Verify the body content matches the Content-Type header
  4. 4. Convert the payload to a supported format

Frequently Asked Questions

How do I fix 415 when sending JSON?

Ensure your request includes Content-Type: application/json header. Many HTTP clients do not set this automatically. In fetch: { headers: { 'Content-Type': 'application/json' } }. In curl: -H 'Content-Type: application/json'.

What is the difference between 415 and 406?

415 means the server does not support the client's Content-Type (request format). 406 means the server cannot produce a response in the format the client requested via the Accept header (response format).

Can 415 occur with file uploads?

Yes. If you upload a .exe file to an endpoint that only accepts images, you may get 415. The server validates the Content-Type or file type and rejects unsupported formats.

Related Status Codes

400 Bad Request 405 Method Not Allowed

Related Reading

HTTP Status Codes Cheat Sheet: Every Code Explained → JSON vs YAML vs TOML: Which Config Format to Use →