- Class
- 2xx success
- Defined in
- RFC 9110, section 15.3.5
- Retry
- Not needed
- Body
- Must be empty
- Cacheable by default
- Yes
When your API should return 204
Return 204 from a DELETE, or from a PUT or PATCH when the client already has everything it needs. It saves bytes and tells the client plainly that there’s no body to look for.
If the client will want the updated resource, return 200 with it, since a client that gets a 204 has to make another request to see what changed. Never send a body with a 204. RFC 9110 says the response ends at the headers, and some clients and proxies read leftover bytes as the start of the next response.
How public APIs declare 204 in their OpenAPI specs
Five of the eleven public specs we score declare a 204, as they were on 4 December 2026. GitHub does on 324 operations, a quarter of its API, and Box and Twilio on 46 and 32.
None of them declares a body for it, which is what RFC 9110 asks for. Stripe and OpenAI return 200 with the deleted object, so a client can show what it removed.
| API | Operations | Declare 204 |
|---|---|---|
| GitHub | 1,288 | 324 |
| Box | 297 | 46 |
| Twilio | 197 | 32 |
| Plaid | 351 | 1 |
| Adyen Checkout | 28 | 1 |
| Stripe | 612 | 0 |
| OpenAI | 406 | 0 |
| Asana | 302 | 0 |
| Slack | 174 | 0 |
| Swagger Petstore | 19 | 0 |
| SendGrid Mail | 3 | 0 |
Counted per operation from each vendor’s public OpenAPI document on 4 December 2026.
Declare 204 in your OpenAPI spec
Declare the 204 with a description and no content. A spec that declares a schema for a 204 tells generators and docs to expect a body that will never arrive.
paths:
/invoices/{invoiceId}:
delete:
operationId: deleteInvoice
parameters:
- name: invoiceId
in: path
required: true
schema:
type: string
responses:
"204":
description: The invoice was deleted.
"404":
$ref: "#/components/responses/NotFound"What an Octri SDK does with a 204
An Octri SDK doesn’t try to parse a 204 or a 205. The response’s data is null, so a delete resolves cleanly with nothing to decode.
A DELETE is idempotent, so the SDK retries it on a 429 or a 500, 502, 503 or 504. Your API should answer a retry for something already deleted with the same 204, or a 404.
import { Acme } from "acme-sdk";
const acme = new Acme({ apiKey: process.env.ACME_API_KEY });
// 204: nothing to decode. Retried on a 503 because DELETE is idempotent.
await acme.invoices.delete({ invoiceId: "inv_123" });More on retries and typed errors in SDK error handling.
HTTP 204 questions
Can a 204 response have headers?
Yes. It can carry any header, like an ETag for the updated resource, so a client can make its next request conditional.
Is 204 the right response to a DELETE?
Yes, when there’s nothing useful to return. Return 200 with a body if the client needs the deleted object, for an undo button or an audit log.
Should a 204 have a Content-Length header?
No. RFC 9110 says a server must not send Content-Length in a 204 response.