OK
2xx Success
Last updated:
The request succeeded. The response body contains the requested representation.
Description
The default success code. For GET, the response contains the resource. For POST/PUT, it usually contains the outcome. For DELETE, some APIs return 200 with a body, though 204 is often more appropriate.
When to use
Return 200 for successful reads and successful writes that return a body.
Common pitfalls
Do not return 200 with an error payload — clients will treat it as success. Use a 4xx or 5xx code instead.
Specification
RFC 9110 §15.3.1
Examples
HTTP/1.1 200 OK
Content-Type: application/json
{"ok":true}res.status(200).json({ error: "OK" });w.WriteHeader(http.StatusOK)
return jsonify({"error": "OK"}), 200Related status codes
Created
A new resource has been created as a result of the request. The URI of the new resource is in the Location header.
No Content
The request succeeded, and there is no additional content to send in the response body.
Partial Content
The server is delivering only part of the resource due to a range header sent by the client.