HTTP Status Codes / 2xx HTTP Status Codes / HTTP 204

204 No Content

This is an educational reference page about HTTP 204 No Content. The page itself is served as 200 OK so it can be indexed as HTTP documentation.

The request succeeded and the response intentionally has no body.

Specification

Registered in the IANA HTTP Status Code Registry as No Content. Defined in RFC 9110, Section 15.3.5.

What it means

HTTP 204 No Content means the server completed the request and has no content to send back. The response ends after the headers, with no body and no trailers. Any headers in the response, such as ETag, describe the target resource after the change.

When to use it

Headers involved

Examples

DELETE with no body

DELETE /api/sessions/current HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOi...

HTTP/1.1 204 No Content

PATCH update that returns the new ETag

PATCH /api/profile HTTP/1.1
Host: api.example.com
Content-Type: application/merge-patch+json
If-Match: "v7"

{
  "timezone": "Europe/London"
}

HTTP/1.1 204 No Content
ETag: "v8"

Common mistakes

Developer notes

204 is heuristically cacheable, like 200. That rarely matters for DELETE or PUT, because caches do not store responses to those methods, but it can matter if you return 204 to a GET.

Questions

What does HTTP 204 No Content mean?

HTTP 204 means the request succeeded and the server intentionally sent no response body.

Should DELETE return 200 or 204?

Return 204 when there is nothing to send back. Return 200 when the response body includes something useful, such as the deleted resource or a summary.

Can a 204 response have a body?

No. A 204 response ends after the header section and cannot contain content.

See also

Header and content rules

What RFC 9110 says about a 204 response, quoted from the RFC.

The same rule is in the response obligations table and its JSON.

2xx successful – the request was successfully received, understood, and accepted


HTTP status code lookup
REST API status code chooser
cURL command generator
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia