HTTP
HTTP 200OK
HTTP 200 OK means the server received the request, understood it and is returning the result. For GET the body is the requested resource; for POST it is the outcome of the action. A 200 is only correct when the request actually succeeded; returning 200 with an error message in the body (a soft 404) misleads clients and search engines.
What 200 means
The request was processed and the response carries the result. What "result" means depends on the method:
| Method | Body of a 200 response |
|---|---|
| GET | The representation of the resource (the page, the JSON, the image) |
| HEAD | Nothing; headers only |
| POST | A description of the outcome, or the resulting resource |
| PUT / DELETE | A status message or the updated resource; 204 is the common alternative |
| OPTIONS | Communication options, typically Allow headers |
Other success codes
- 201 Created — a new resource exists;
Locationsays where. - 202 Accepted — the request is queued for later processing.
- 204 No Content — success, nothing to send back; the browser stays on the current page.
- 206 Partial Content — a byte range was returned, used for resumable downloads and video seeking.
When 200 is the wrong answer
- Soft 404: a "page not found" template served with 200. Search engines cannot distinguish it from a real page; uptime monitors see success.
- Error inside JSON: an API returning
{"error": "invalid token"}with 200 forces clients to parse bodies to detect failure. Use 400, 401, 403 or 422 as appropriate. - Login page with 200 for a protected resource: should be 401 or 302 to the login page, depending on design.
Verifying
curl -I https://example.com/some-pageThe first line shows HTTP/2 200 or HTTP/1.1 200 OK. Add -L to follow redirects and see the final code. See the curl record.
Frequently asked questions
What is a soft 404?
A page that says "not found" but returns 200. Search engines may index the error page, and monitoring that checks status codes never notices the failure. The fix is to return the real code: 404 for missing, 410 for permanently removed.
Should a successful POST return 200 or 201?
201 Created when a new resource was made and the response identifies it (Location header). 200 for other successful actions, or 204 No Content when there is nothing to return.