HTTP 200 OK — The Success Response Explained with Examples
The request succeeded. The meaning of 'success' depends on the HTTP method: GET returns the resource, POST returns the result of the action, PUT/PATCH returns the updated resource (or nothing). 200 is the most common HTTP response status.
When to Return 200
Use 200 for successful GET, PUT, PATCH, and DELETE responses. For POST requests that create a new resource, prefer 201 Created. For successful operations with no response body, use 204 No Content.
HTTP Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 1, "name": "Alice"}Code Examples
Express.js
app.get('/users/:id', async (req, res) => {
const user = await db.users.findById(req.params.id)
if (!user) return res.sendStatus(404)
res.status(200).json(user) // 200 is the default — .json() alone works
})Next.js App Router
// app/api/users/[id]/route.ts
export async function GET(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params
const user = await db.users.findById(id)
if (!user) return new Response(null, { status: 404 })
return Response.json(user) // 200 by default
}Related Status Codes
Frequently Asked Questions
What does HTTP 200 OK mean?
The request succeeded. The meaning of 'success' depends on the HTTP method: GET returns the resource, POST returns the result of the action, PUT/PATCH returns the updated resource (or nothing). 200 is the most common HTTP response status.
When should an API return 200?
Use 200 for successful GET, PUT, PATCH, and DELETE responses. For POST requests that create a new resource, prefer 201 Created. For successful operations with no response body, use 204 No Content.
