devkult_
tools29converters34

200 OK

2xx success

The request succeeded, and the response body holds the result.

200 is the default success status. What success means depends on the method: for GET the body is the resource, for POST it's the result of the action, for HEAD it's the same headers as GET without a body.

It's also the most misused status. An API that returns 200 with {"error": …} in the body breaks caches, monitoring and every client that checks response.ok.

Class2xx Success
Retry?Not applicable
Cacheable by defaultYes (heuristically, per RFC 9110)
Response bodyAllowed
Defined inRFC 9110 §15.3.1 — 200 OK
Example response
HTTP/1.1 200 OK
Content-Type: application/json

When you'll see it

  • A GET returned the requested resource.
  • A POST, PUT or PATCH completed and the response describes the outcome.
  • A search or listing ran — even an empty list is a 200.

How to use it well

  1. Return 201 Created with a Location header when a POST creates something.
  2. Return 204 No Content when there's nothing useful to send back, such as after a DELETE.
  3. Never return 200 for a failure. Use 4xx for client errors and 5xx for server errors, so fetch(), caches and uptime checks see the truth.

Useful here: HTTP caching explained

Send a 200 from your server

Express
res.status(200).json(result);
Next.js route handler
return Response.json(result, { status: 200 });
Flask
return result, 200
Go net/http
w.WriteHeader(http.StatusOK)
nginx
return 200;

Check what a URL returns

Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.

curl -sI https://example.com/your-path | head -n 1

Frequently asked questions

Should an empty search result be 200 or 404?

200 with an empty list. The search endpoint exists and worked; it just found nothing. 404 means nothing exists at that URL.

Is a 200 response cached?

A 200 to GET is cacheable by default: browsers and CDNs may store it heuristically unless Cache-Control says otherwise. Send explicit Cache-Control on dynamic responses.

Headers used with 200
Related status codes