204 No Content

The request succeeded and there is deliberately no response body.

What 204 means

204 means success with nothing to say. It is the natural response to a DELETE that removed something, a PUT or PATCH where the client already knows the resulting state, and any action endpoint with no meaningful result to return.

A 204 response must not include a body. This is a hard rule, not a convention, and violating it causes real problems: some clients and intermediaries mis-frame the response or wait for content that never arrives. Frameworks that automatically serialise a return value can produce a 204 with a body without you noticing.

Content-Length must also be absent rather than 0 in a strict reading, though in practice most stacks handle either.

Should a client retry?

Succeeded. A retried DELETE that returns 204 again is fine - DELETE is idempotent.

FAQ

Can a 204 response have a body?
No. The specification forbids it, and sending one causes clients and proxies to mis-frame the response or hang. Watch for frameworks that serialise a return value automatically.
204 or 200 for a successful DELETE?
204 when there is nothing useful to return, which is the usual case. 200 with a body is fine if you have something worth sending - a summary of what was removed, for instance.
What should a DELETE return if the resource was already gone?
Either 204 (treating delete as idempotent, which is the common and friendlier choice) or 404. Pick one and document it - clients writing retry logic need to know.

Often confused with

  • 200 OK The request succeeded and the response carries the result.
  • 404 Not Found The server has no resource at that URL.