Skip to content

By the Octri team · Updated

204 No Content

Share

A 204 means the request worked and there’s nothing to send back. The response has headers and no body, and a client that tries to parse one will usually fail.

All HTTP status codes

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.

APIOperationsDeclare 204
GitHub1,288324
Box29746
Twilio19732
Plaid3511
Adyen Checkout281
Stripe6120
OpenAI4060
Asana3020
Slack1740
Swagger Petstore190
SendGrid Mail30

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.

yaml
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.

typescript
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.

Share