Error Codes Wiki

HTTP 415 Unsupported Media Type — Content-Type Mismatch

Warning4xx client error

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).