🫥
204
No Content

Example HTTP Response

HTTP Response
HTTP/1.1 204 No Content
Common Causes
  • Successfully deleted a resource
  • Update that doesn't need to return data
  • Preflight CORS request succeeded
Technical Details

What does this mean?

Mission accomplished, but there's nothing to show for it. Like successfully deleting a file — it's gone, nothing to see here!

Technical Definition

The server successfully processed the request and is not returning any content.

RFC Says

"The 204 (No Content) status code indicates that the server has successfully fulfilled the request and that there is no additional content to send in the response payload body."

Plain English:

The operation succeeded, but there's nothing to send back. Commonly used for DELETE requests or PUT requests where you don't need to return the updated resource. The response should not include a message body.

Common Misinterpretation

Some developers use 200 with an empty body instead of 204. Use 204 when there's intentionally no content to return - it's more semantically correct and saves bandwidth by not requiring a Content-Length header or message body.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(204).json({
    error: 'No Content',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(204, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'No Content',
    message: 'Your error message here'
  }));
}).listen(3000);