HTTP 200 OK

Quick answer

HTTP 200 OK is the standard success response. The request succeeded and the response body contains the requested data.

What HTTP 200 means

200 OK is the most common HTTP status code. It tells the client the request was received, understood, and processed successfully. For a GET request the body contains the requested resource; for POST or PUT it usually contains the result of the operation.

Unlike 201 Created, a 200 does not imply a new resource was created — it simply means success.

Common causes

Example JSON response

{
  "data": {
    "id": 123,
    "name": "Ada Lovelace",
    "email": "ada@example.com"
  }
}

Raw HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 84

How to handle HTTP 200

Handling HTTP 200 in client code

A 200 is the happy path, but robust clients still verify it explicitly rather than assuming any non-error means success. With fetch(), check response.ok (true for 200–299) before reading the body — and remember fetch does not reject on 4xx/5xx, so this check is what separates success from failure:

const res = await fetch('/api/users/123');
if (!res.ok) throw new Error(`Request failed: ${res.status}`);

// 200 reached — but guard against an empty/non-JSON body
const text = await res.text();
const user = text ? JSON.parse(text) : null;

If you need to format or eyeball a 200 response while debugging, paste it into the JSON Formatter — or see how to read a minified JSON API response.

200 vs 201 vs 204 — which success code?

The three common success codes are not interchangeable; each tells the client something different:

CodeMeaningBodyUse when
200 OKGeneric successYesGET, or an update/action that returns data
201 CreatedSuccess + resource createdUsuallyPOST that creates a new resource (add Location)
204 No ContentSuccess, nothing to returnNoDELETE, or a PUT with no useful response body

Frequently Asked Questions

Does a 200 response always contain a body?

Almost always, but not strictly required. A 200 OK typically returns a body with the requested data. If there is genuinely no content to return, APIs often use 204 No Content instead.

What is the difference between 200 and 201?

200 OK means the request succeeded. 201 Created means the request succeeded and also created a new resource, usually returning a Location header pointing to it. Use 201 for successful resource creation, 200 for everything else.

Should a successful POST return 200 or 201?

If the POST created a new resource, return 201 Created. If it performed an action without creating a resource (for example a search or a calculation), 200 OK is appropriate.

Does fetch() treat a 200 differently from a 404?

No — fetch() resolves for both; it only rejects on network failures. A 404 is still a completed HTTP exchange. You must check response.ok or response.status yourself to distinguish a 200 from an error status.

Can a 200 response still represent a failure?

It shouldn't, but some APIs return 200 with an {"error": ...} body — an anti-pattern. Prefer the correct status code (4xx/5xx) so clients can rely on the HTTP status. If you must consume such an API, check the body's own success flag in addition to the status.

Working with a JSON API response?

Format and inspect any response in your browser — nothing is uploaded.

JSON Formatter JSON Validator All HTTP Status Codes
About the author

Pasindu Ishan is a software developer based in Sri Lanka. He builds privacy-first developer tools at JSON Dev Tools.