HTTP Status Codes

204 204 No Content

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

What Is This?

The HTTP 204 No Content status code indicates that the server successfully processed the request but is not returning any content. The response body must be empty. It is commonly used for DELETE operations, PUT updates that return no body, and API endpoints that perform actions without returning data.

Common Causes & Solutions

1

Common Cause

Successful DELETE request with no response body

2

Common Cause

PUT/PATCH update where the client already has the latest data

3

Common Cause

API endpoint that triggers an action without returning data

4

Use 204 for idempotent operations

204 is ideal for DELETE and PUT operations where the client does not need confirmation data back. It reduces bandwidth and simplifies client handling.

// DELETE without body response
app.delete('/api/users/:id', (req, res) => {
  deleteUser(req.params.id)
  res.status(204).send() // No body
})
5

Handle 204 in clients

When your client receives 204, do not attempt to parse the response body. Clear any cached representation of the deleted or updated resource.

Related Entries

More from this reference:

Frequently Asked Questions

When should I use 204 vs 200 with empty body?

Always use 204 when there is no content to return. It is semantically correct and tells the client explicitly not to expect a body. A 200 OK with an empty body or null body is ambiguous and less idiomatic.

Can 204 have headers?

Yes. 204 responses can include headers like Cache-Control, ETag, or custom headers. Only the body must be empty. This allows the server to provide metadata about the operation without returning content.