204

HTTP 204 No Content

2xx Success

2xx Success RFC 7231, Section 6.3.5

What is HTTP 204 No Content?

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. Metadata in the response header fields refer to the target resource and its selected representation after the requested action. This is commonly used for DELETE operations or form submissions where no response body is needed.

Common Use Cases

  • Successful DELETE operation in API
  • Form submission where only a status is needed
  • Analytics tracking endpoints

Usage Example

When a client sends a DELETE request to remove a resource, respond with 204 No Content and no body. For PUT or PATCH updates where the client already has the latest data, you can also use 204 to confirm the update without resending data. This keeps API responses lightweight.

// Laravel - returning 204 No Content
return response()->noContent();

// Before Laravel 9
return response('', 204);

Common Mistakes

⚠️

Mistake: Including a response body with 204 No Content

Fix: A 204 response must have no body. Do not include JSON, HTML, or any content. The browser or HTTP client will ignore any body sent with a 204 response.

⚠️

Mistake: Using 204 for GET requests that should return data

Fix: If a GET request succeeds and there is data to return, use 200 OK. 204 is appropriate when the server intentionally has no content to send, such as after a DELETE or a tracking beacon.

Last updated: 21 Jun 2026