204 No Content
The HTTP 204 No Content status code indicates a request completed successfully with no message body in the response.
A 204 No Content response is cacheable by default and an ETag header is included in this case. To override this behavior, the response needs to include the appropriate Cache-Control headers.
Usage
The 204 No Content status code is returned in response to a POST, PUT, or DELETE operation where no message body is expected. Some servers return a 200 with an empty body and a Content-Length of 0 instead.
A practical use case is the result of a form submission where the user presses a "Save" button. The server commits the changes and relies on the client informing the user of success.
The server must not include a message body in a 204 response. Headers like Cache-Control and ETag are still sent and apply to the document identified by the request.
The related 205 Reset Content status also returns no body but additionally instructs the client to reset the document view (for example, clearing a form after submission). A conditional GET returns a 304 to signal the resource does not need to be retrieved again.
SEO impact
Google cannot process a 204 response because no content is received. A URL consistently returning 204 will not appear in search results.
Example
The client posts XML data to the server defining a job. The server responds confirming the data was accepted and the job completed. No content needs to be returned, making the 204 No Content status code appropriate.
Request
POST /job HTTP/1.1
Host: www.example.re
Content-Type: application/xml
Content-Length: 68
<?xml version="1.0"?>
<job>
<id>125</id>
<task>G01</task>
</job>
Response
HTTP/1.1 204 No Content
Code references
.NET
HttpStatusCode.NoContent
Rust
http::StatusCode::NO_CONTENT
Rails
:no_content
Go
http.StatusNoContent
Symfony
Response::HTTP_NO_CONTENT
Python3.5+
http.HTTPStatus.NO_CONTENT
Java
java.net.HttpURLConnection.HTTP_NO_CONTENT
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_NO_CONTENT
Angular
@angular/common/http/HttpStatusCode.NoContent
Takeaway
The HTTP 204 No Content status code confirms a request completed successfully. All relevant information is in the response headers, with no message body present.