HTTP 204 No Content
Updated Free mock REST & WebSocket APIs
HTTP 204 No Content — The request succeeded and there is intentionally no response body.
- Class
- 2xx Success
- Defined in
- RFC 9110 §15.3.5
- Official
- Yes (IANA registry)
- Cacheable by default
- Yes (heuristically, per RFC 9110)
Try it: get a real 204 response
Our test endpoint answers every request with 204 No Content.
curl -i https://mockfox.dev/api/status/204Use it in tests, health-check monitors or to see how your client handles a 204. Add ?delay=2000 to slow it down.
What does HTTP 204 mean?
204 No Content means the server successfully processed the request and is intentionally not returning a body. The response ends right after the headers; any body sent with a 204 is invalid and will be ignored or cause parsing errors.
Headers in a 204 can still carry useful metadata, such as an updated ETag. In a browser, a 204 response to a link or form submission leaves the current page as it is.
When is 204 used?
- DELETE succeeded:
DELETE /posts/7→ 204. - PUT or PATCH saved changes and the client already knows the new state.
- CORS preflight (OPTIONS) responses.
- Analytics beacons and "fire and forget" endpoints (
navigator.sendBeacon).
Why you're seeing 204
- The action succeeded and there's simply nothing to send back.
- If you expected data, the endpoint may be designed for writes only, or a cache/proxy may be configured to answer with 204 (e.g. a tracking or health endpoint).
What to do about 204
If you're visiting the site
- Nothing is broken. If a button seems to do nothing, the action likely succeeded silently; refresh the page to see the result.
If you run the site or API (developers)
- Don't send a body or
Content-Lengthother than 0; frameworks strip it, but a raw server writing a body after 204 confuses HTTP/1.1 clients. - Client code: don't call
res.json()on a 204 — it throws "Unexpected end of JSON input". Checkres.status === 204first. - Return 200 with the updated resource instead if clients need server-generated fields.
Sending 204: server examples
nginx
# Answer CORS preflights directly
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE";
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
return 204;
}Express
app.delete("/api/posts/:id", async (req, res) => {
await db.posts.delete(req.params.id);
res.sendStatus(204); // or res.status(204).end()
});Next.js
// app/api/example/route.ts (Next.js App Router)
export async function DELETE() {
await deletePost();
return new Response(null, { status: 204 });
}Example 204 response
HTTP/1.1 204 No Content Date: Sun, 18 Oct 2026 10:00:00 GMT Access-Control-Allow-Origin: *
Related status codes
- 200 OKThe request succeeded and the response contains the result.
- 205 Reset ContentThe request succeeded and the client should reset the document view (e.g. clear a form).
- 304 Not ModifiedThe cached copy the client already has is still valid, so no body is sent.
Related tools
Frequently asked questions
Can a 204 response have a body?
No. RFC 9110 says a 204 response ends after the header section. Send 200 if you need to return content.
Why does response.json() fail on my 204?
Because there's no body to parse. Check if (res.status !== 204) data = await res.json(), or have the server return 200 with JSON.
Is 204 or 200 better for DELETE?
Both are fine. 204 is the most common for DELETE; use 200 if you return something like the deleted item or a confirmation message. 202 suits deletes that happen asynchronously.