HTTP 415 Unsupported Media Type
The server refuses the request because the body’s Content-Type isn’t one it accepts.
Meaning
The endpoint expects a specific body format (usually application/json) and the request declared — or defaulted to — something else, like text/plain or application/x-www-form-urlencoded.
Common causes
- Missing
Content-Type: application/jsonheader - Sending form data to a JSON-only endpoint (or vice versa)
- Wrong charset or vendor media type (
application/vnd.api+json) - Uploading a file type the endpoint doesn’t allow
⚡ Quick fix
- Set the correct Content-Type header for the body you send
- Check API docs for the required media type
- With
FormDatain browsers, do NOT set Content-Type manually — the browser adds the boundary
Detailed fix by platform
JavaScript
- JSON vs multipart:javascript
// JSON fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); // File upload — let the browser set multipart/form-data; boundary=... const fd = new FormData(); fd.append('file', file); fetch(url, { method: 'POST', body: fd });
.NET
- ASP.NET Core
[ApiController]requires JSON by default; use[FromForm]for form posts.
How to diagnose
- Header — What Content-Type did the client send?
- Endpoint — What does the endpoint consume?
- Body — Does the body actually match the declared type?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026