415 Unsupported Media Type
Server refuses request because payload format is unsupported.
The media format of the requested data is not supported by the server.
What HTTP 415 Unsupported Media Type Means
The media format of the requested data is not supported by the server.
Server refuses request because payload format is unsupported.
Common Causes
- Wrong Content-Type header
- Sending XML to JSON-only API
- Unsupported file format
How to Fix It (For Visitors)
- Check file format is supported
How to Fix It (For Developers/Admins)
- Set correct Content-Type header
- Check API accepts your data format
- Verify Accept header
- Convert to supported format
Fixing 415 in JavaScript and .NET
The most common cause is a missing or wrong Content-Type. When you pass a string body to fetch() without a header, it is sent as text/plain;charset=UTF-8, which JSON APIs reject:
fetch('/api/items', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'test' })
});In ASP.NET Core, a [FromBody] parameter returns 415 when the request's content type has no matching input formatter; use [FromForm] for form posts. 415 vs 406: 415 is about what you send (Content-Type), 406 is about what you ask to receive (Accept).
Returning a 415 Unsupported Media Type (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 415 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(415).json({ error: 'Unsupported Media Type' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Unsupported Media Type'), 415
PHP
<?php
http_response_code(415);
header('Content-Type: application/json');
echo json_encode(['error' => 'Unsupported Media Type']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 415 Unsupported Media Type
Frequently Asked Questions
What does HTTP 415 Unsupported Media Type mean?
Server refuses request because payload format is unsupported. In short: The media format of the requested data is not supported by the server.
Is 415 Unsupported Media Type a client or server error?
415 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.
How do I fix a 415 Unsupported Media Type error?
Set correct Content-Type header. Check API accepts your data format. Verify Accept header.
Official Specification
The 415 Unsupported Media Type status code is defined in RFC 9110 Section 15.5.16.