HTTP 415 · 4XX RFC 9110 §15.5.16 Cacheable: No Retryable: No (fix Content-Type header)

HTTP 415 Unsupported Media Type: Root Causes & Production Fix Guide

HTTP 415 Unsupported Media Type means the server refused the payload because the request's `Content-Type` or `Content-Encoding` header is not supported by the endpoint.

Top Root Causes of HTTP 415

Correct Content-Type in fetch() & curl

// Browser fetch for JSON
await fetch('https://api.example.com/v1/items', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'widget' }),
});
// Note: For FormData uploads, DO NOT manually set Content-Type!

Verify with cURL

curl -i -sS -X POST -H 'Content-Type: application/json' -d '{"name":"widget"}' https://api.example.com/v1/items

Interactive Stack Diagnoser (HTTP 415)

Frequently Asked Questions

Why does setting Content-Type: application/json trigger a CORS preflight?

Because `application/json` is not a CORS-safelisted content type. Your server must answer the `OPTIONS` preflight with `Access-Control-Allow-Headers: Content-Type`.

Why do FormData file uploads fail with 415 when I set Content-Type?

Manually setting `Content-Type: multipart/form-data` omits the required `; boundary=----...` token. Omit the header and let `fetch()` set it automatically.

What response header helps clients recover from 415?

Return `Accept-Post: application/json` or an RFC 9457 error body listing accepted media types.

Related Status Guides & Header Tools