4xx Client error · RFC 9110 §15.5.16

415 Unsupported Media Type

The request body is in a format the server does not accept.

What 415 means

The Content-Type of the request is not one the endpoint supports: sending form data to a JSON API, or omitting the header so it defaults to text/plain.

It is about the request format, not the response; when the client cannot accept the response format, the code is 406.

Common causes

  • Missing Content-Type: application/json on a JSON POST.
  • multipart/form-data sent to an endpoint expecting JSON.
  • Wrong charset or an unsupported image format on an upload endpoint.

How to fix it

  • Set the exact Content-Type the API documents.
  • For fetch(), pass headers: { "Content-Type": "application/json" } and JSON.stringify the body.

What it looks like

A typical response:

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

The same event in an nginx access log (the status is the number after the request line):

203.0.113.7 - - [10/Sep/2026:10:12:01 +0000] "POST /api/orders HTTP/1.1" 415 153 "-" "Mozilla/5.0"

Check it with curl

-i prints the status line and headers, and -w '%{http_code}' prints only the number, which is handy in scripts and health checks. Replace the URL with yours:

curl -i -X POST -H 'Content-Type: application/json' -d '{"a":1}' https://example.com/api/orders

Compare what curl sees with what the browser sees. A different status from the same URL usually means a cache, a CDN edge or a cookie is in the way.

Investigating a run of 415s? Paste the log excerpt into Log Share to get line numbers, highlighting and an expiring link for whoever is on call with you.

  • 400Bad Request: The server could not understand the request because it is malformed.
  • 406Not Acceptable: no response format matches the Accept header.
  • 422Unprocessable Content: The request is syntactically valid but semantically wrong.

FAQ

Why does curl -d give me 415?

curl -d sends application/x-www-form-urlencoded by default. Add -H "Content-Type: application/json".