204 Success 📋

204 No Content: Success Without a Payload

Last updated: June 28, 2026 • 5 min read

✦ The Golden Answer: The 204 No Content status code indicates that the server successfully processed the request but is intentionally not returning any content in the response body. This is the ideal response for operations like DELETE, or for PUT/POST when the client doesn't need additional data. The response must have a Content-Length: 0 header and an empty body.

When to Use 204 No Content

  • DELETE – after successfully deleting a resource, there is no need to return anything.
  • PUT – when the client already has the updated representation and doesn't need it back.
  • POST – for actions that don't create a new resource (e.g., "like", "follow") where no data is returned.
  • PATCH – when the update is applied and the server does not send back the updated resource.

Required Headers

A 204 response must include:

  • Content-Length: 0 – to indicate an empty body.
  • No Content-Type header (or it may be omitted).
  • Optionally, Cache-Control, ETag, or other metadata headers may be included, but they are not required.
HTTP/1.1 204 No Content Content-Length: 0

Example Flows

HTTP MethodRequestResponse
DELETEDELETE /api/users/123 HTTP/1.1HTTP/1.1 204 No Content
Content-Length: 0
PUT (no body return)PUT /api/users/123 HTTP/1.1
{"name":"John"}
HTTP/1.1 204 No Content
Content-Length: 0
POST (action)POST /api/posts/456/like HTTP/1.1HTTP/1.1 204 No Content
Content-Length: 0

Client Behaviour

When a client receives 204:

  • It should not expect any response body.
  • It should keep the current view (e.g., the page does not refresh or change).
  • It can use this as a signal that the operation succeeded and optionally update its local state.

When Not to Use 204

  • If you need to return data – use 200 OK with a body.
  • If a new resource was created – use 201 Created with a Location header.
  • If the request is invalid – use 400 Bad Request or 422 Unprocessable Entity.

Frequently Asked Questions

Is 204 No Content the same as 200 OK with an empty body?

No. 200 OK explicitly allows a body (even if empty) and may include headers like Content-Type. 204 specifically forbids a body and must have Content-Length: 0. Clients treat 204 as a "success with no additional info" and usually do not change the view.

Can I include headers with 204?

Yes, you can include headers like Cache-Control, ETag, or Location. However, the body must be empty, and Content-Length: 0 is required.

What if I accidentally send a body with 204?

It violates the specification. Some clients may ignore the body, but others may fail. Always ensure the response body is empty.