More
More
415 Unsupported Media Type
The server does not accept the format of the request body.
- Code
415- Reason phrase
- Unsupported Media Type
- Class
- 4xx Client error
- Defined in
- RFC 9110 section 15.5.16
- Cacheable by default
- No
What it means
Client error: the problem lies with the request. Repeating it unchanged will normally fail again.
When a server should send it. When the server will not accept the body's format, as stated in Content-Type or Content-Encoding. If the problem is the encoding, add an Accept-Encoding header listing what it does accept; for the type, Accept-Post or Accept-Patch can list accepted types.
Common causes. Sending form data to an API that expects JSON, or a missing or wrong Content-Type header.
What to do. Set Content-Type to what the API expects, such as application/json.
How clients and crawlers treat it
Browsers and HTTP clients. Mostly seen in API work, for example when a request posts form data to a JSON-only endpoint or forgets the Content-Type header.
Google Search. Like every 4xx except 429, it tells Google the content does not exist: an indexed URL is removed from the index, and a new one is not processed. Crawl frequency for the URL gradually drops. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.
Example response
HTTP/1.1 415 Unsupported Media Type
Accept-Post: application/json
{"status": 415, "title": "Unsupported Media Type"}
How to send 415
location /example {
return 415;
}
RewriteEngine On RewriteRule ^example$ - [R=415,L]
http_response_code(415); echo 'Unsupported Media Type'; exit;
res.writeHead(415, { 'Content-Type': 'text/plain' });
res.end('Unsupported Media Type');
# in a view function return 'Unsupported Media Type', 415
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 400Bad RequestThe server could not understand the request.
- 406Not AcceptableThe server cannot produce a response in any format the client's Accept headers allow.
- 422Unprocessable ContentThe request is well formed but its data fails validation.
All status codes · All 4xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.