📚 Quick Definition

The server has successfully fulfilled the request and there is no additional content to send in the response. The response has no body. This status code is ideal for operations where the client does not need any data back, such as deleting a resource or saving a setting.

When It Occurs

A 204 No Content response is returned when the server has processed the request successfully but intentionally has nothing to return in the response body. The operation completed, but the server determined that no content needs to be sent back to the client. The client's current view does not need to change.

🛠 Common Use Cases

  • DELETE operation successfully removing a resource
  • PUT/PATCH update that doesn't need to return the updated data
  • Form submission with no display change needed on the page
  • Auto-save operations where the UI doesn't need confirmation data
  • Toggle or switch actions (e.g., mark as read, favorite)
  • Acknowledgment endpoints (e.g., webhook receivers, heartbeats)

Best Practices

  • Never include a response body with a 204 - clients may ignore or reject it
  • Use 204 for DELETE operations where you don't need to return the deleted resource
  • Common for fire-and-forget API patterns where the client just needs a success signal
  • Headers can still be sent with 204 (e.g., Cache-Control, ETag for caching)
  • Consider using 200 instead if the client needs confirmation data or the updated resource

📡 HTTP Example

Request
DELETE /api/users/123 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGci...
Response
HTTP/1.1 204 No Content
Date: Thu, 20 Feb 2026 10:30:00 GMT

(no body)

Frequently Asked Questions

Does 204 mean the resource was deleted? +
Not necessarily. A 204 No Content response simply means the server successfully processed the request and has no body to return. While it is commonly used as the response for DELETE operations, it can also be returned for PUT, PATCH, or POST requests where no response body is needed, such as auto-save operations or toggle actions.
Can 204 have headers? +
Yes, a 204 No Content response can and often does include headers. The restriction applies only to the response body, which must be empty. Headers like Cache-Control, ETag, Date, and custom headers can still be sent with a 204 response to provide metadata about the operation or caching instructions.