4xx Client Errors

HTTP 415 Unsupported Media Type

The request payload format is not supported by the server for the target resource.

When is 415 used?

  • Sending XML to a JSON-only API
  • Uploading unsupported file types

How to handle a 415 response

Inspect the request — URL, method, headers, credentials, and body. Retrying the same request unchanged will usually fail again; 429 is the exception, where you should wait for the Retry-After period.

Check the status code a URL returns from the command line:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

How to return 415 from your server

Node.js (Express)

res.status(415).json({ message: 'Unsupported Media Type' });

Python (Flask)

return {"message": "Unsupported Media Type"}, 415

Go (net/http)

w.WriteHeader(415)

Frequently Asked Questions

What does HTTP 415 mean?

415 Unsupported Media Type: The request payload format is not supported by the server for the target resource.

Is 415 an error?

Yes. 415 is in the 4xx Client Errors class. Client errors: the request is malformed, unauthorized, or targets something that does not exist.