204 No Content

Success - Request succeeded, no body returned

HTTP 204 No Content

What It Means

The HTTP 204 No Content status code indicates that the server successfully processed the request, but is not returning any content. The response must not contain a response body.

When to Use 204

  • DELETE requests: After successfully deleting a resource
  • PUT/PATCH requests: When update succeeds but you don't need to return the updated resource
  • Auto-save operations: Background saves that don't need confirmation data
  • Acknowledgments: When you just need to confirm receipt

Example Response

HTTP/1.1 204 No Content
Date: Mon, 15 Jan 2025 10:30:00 GMT
X-Request-Id: abc123

(no body)

204 vs 200 with Empty Body

Don't return 200 with an empty body. If there's no content to return, use 204. The semantic difference matters:

  • 200 {} — "Here's your empty object"
  • 204 — "Success, nothing to return"

Common Use Cases

Operation Response
DELETE /api/users/123 204
PUT (update, no return needed) 204
POST /api/logout 204
POST /api/read-receipts 204

Important Notes

  • 204 responses must not include a message body
  • The response is terminated by the first empty line after headers
  • Can include headers like ETag or custom headers
  • Browsers may retain the current page when receiving 204

When NOT to Use 204

  • When the client needs the updated resource (use 200 with body)
  • When creating resources (use 201)
  • When returning search results, even if empty (use 200 with empty array)

Monitor your API responses

Ensure your DELETE endpoints return correct status codes.

Start monitoring free →

Related Status Codes