2xx Success

HTTP 200 OK

HTTP 200 OK means the request succeeded and the response body contains the requested resource.

What 200 OK means

A 200 is the normal answer to a successful GET, and to a POST or PUT that returns the result in the body. It says nothing about whether the content is correct: an API that returns 200 with { "error": "not found" } in the body is lying to every client, cache and crawler that reads the status line.

Common causes

  • A page or API resource was found and returned.
  • A form or API call succeeded and the server replies with the result.
  • A "soft 404": an error or empty page wrongly sent with 200.

How to fix or use it

Return 200 only for real successes. Send errors with a matching 4xx or 5xx code, and return 201 or 204 where they describe the result better.

Express (Node.js) example

app.get('/api/users/:id', async (req, res) => {
  const user = await User.findById(req.params.id);
  if (!user) return res.status(404).json({ message: 'User not found' });
  res.status(200).json(user); // 200 is the default, shown for clarity
});

SEO impact

Google indexes 200 pages. An error page served with 200 becomes a soft 404 in Search Console and wastes crawl budget, so make SSR error pages set the real status code.

Other 2xx Success codes