Error Codes Wiki

HTTP 415 Unsupported Media Type — Content-Type Mismatch

Warning4xx client error

About HTTP 415 Unsupported Media Type

HTTP 415 Unsupported Media Type means the server refuses the request because the Content-Type of the request body is not supported by the endpoint. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Server cannot process the request body format specified in Content-Type header. Common when sending JSON to an endpoint that expects form data or vice versa. API endpoints often accept only specific Content-Types (application/json, multipart/form-data). Missing Content-Type header can also trigger 415 on strict servers. Different from 406 Not Acceptable which is about response format (Accept header). Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Sending application/json when the server expects application/x-www-form-urlencoded. Missing Content-Type header on POST/PUT request. Sending XML to a JSON-only API endpoint. File upload without multipart/form-data Content-Type. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Check API documentation for accepted Content-Type values. Set Content-Type header explicitly: Content-Type: application/json. For file uploads, use Content-Type: multipart/form-data with boundary. In curl: curl -H 'Content-Type: application/json' -d '{"key":"value"}' URL. Verify your HTTP library is not overriding the Content-Type you set. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What is the difference between 415 and 406?

415 is about the request Content-Type (what you send). 406 is about the Accept header (what you want back).

Overview

HTTP 415 Unsupported Media Type means the server refuses the request because the Content-Type of the request body is not supported by the endpoint.

Key Details

  • Server cannot process the request body format specified in Content-Type header
  • Common when sending JSON to an endpoint that expects form data or vice versa
  • API endpoints often accept only specific Content-Types (application/json, multipart/form-data)
  • Missing Content-Type header can also trigger 415 on strict servers
  • Different from 406 Not Acceptable which is about response format (Accept header)

Common Causes

  • Sending application/json when the server expects application/x-www-form-urlencoded
  • Missing Content-Type header on POST/PUT request
  • Sending XML to a JSON-only API endpoint
  • File upload without multipart/form-data Content-Type

Steps

  1. 1Check API documentation for accepted Content-Type values
  2. 2Set Content-Type header explicitly: Content-Type: application/json
  3. 3For file uploads, use Content-Type: multipart/form-data with boundary
  4. 4In curl: curl -H 'Content-Type: application/json' -d '{"key":"value"}' URL
  5. 5Verify your HTTP library is not overriding the Content-Type you set

Tags

http415unsupported-media-typecontent-typeapi

More in 4xx Client Error

Frequently Asked Questions

415 is about the request Content-Type (what you send). 406 is about the Accept header (what you want back).