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
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 7231 Section 6.5.13.