Aarunya AppsAarunya Apps
204
No Content
Success

HTTP 204 No Content — When to Use It in REST APIs

The request succeeded but there is no content to send in the response body. The server must not include a message body. Commonly returned by DELETE operations and successful updates when no data needs to be returned.

When to Return 204

Use 204 for successful DELETE operations, successful PUT/PATCH when you don't need to return the updated resource, and action endpoints (like /logout) that succeed with nothing to return.

HTTP Response Example

HTTP/1.1 204 No Content

Code Examples

Express.js
app.delete('/users/:id', async (req, res) => {
  await db.users.delete(req.params.id)
  res.sendStatus(204) // No body
})

app.put('/settings', async (req, res) => {
  await db.settings.update(req.body)
  res.sendStatus(204)
})
Next.js App Router
// app/api/users/[id]/route.ts
export async function DELETE(
  request: Request,
  { params }: { params: Promise<{ id: string }> }
) {
  const { id } = await params
  await db.users.delete(id)
  return new Response(null, { status: 204 })
}

Related Status Codes

All HTTP status codes

Browse the complete HTTP status code reference.

All Status Codes

Frequently Asked Questions

What does HTTP 204 No Content mean?

The request succeeded but there is no content to send in the response body. The server must not include a message body. Commonly returned by DELETE operations and successful updates when no data needs to be returned.

When should an API return 204?

Use 204 for successful DELETE operations, successful PUT/PATCH when you don't need to return the updated resource, and action endpoints (like /logout) that succeed with nothing to return.