HTTP Status Codes / 2xx HTTP Status Codes / HTTP 200

200 OK

This is an educational reference page about HTTP 200 OK. The page itself is served as 200 OK so it can be indexed as HTTP documentation.

The request succeeded. What the response body contains depends on the request method.

Specification

Registered in the IANA HTTP Status Code Registry as OK. Defined in RFC 9110, Section 15.3.1.

What it means

HTTP 200 OK means the request succeeded. The body depends on the method: a GET returns the requested resource, a POST returns the result of the action, and a PUT or DELETE returns the status of the action.

When to use it

Headers involved

Examples

GET a resource

GET /api/orders/1042 HTTP/1.1
Host: api.example.com
Accept: application/json

HTTP/1.1 200 OK
Content-Type: application/json
ETag: "a3f9"
Cache-Control: private, max-age=0

{
  "id": 1042,
  "status": "paid",
  "total": "49.00"
}

PATCH that returns the updated resource

PATCH /api/orders/1042 HTTP/1.1
Host: api.example.com
Content-Type: application/merge-patch+json

{
  "status": "shipped"
}

HTTP/1.1 200 OK
Content-Type: application/json
ETag: "b71c"

{
  "id": 1042,
  "status": "shipped",
  "total": "49.00"
}

Common mistakes

Developer notes

200 is the default success code, so most of the work is deciding when another 2xx code fits better. Send 201 when the request created a resource, 202 when the work runs later, and 204 when there is nothing to return.

Questions

What does HTTP 200 OK mean?

HTTP 200 means the request succeeded. The response body depends on the method: a resource for GET, or the outcome of the action for POST, PUT, and DELETE.

Should an API return 200 or 201 after POST?

Return 201 when the POST created a resource. Return 200 when the POST performed an action that did not create a new resource, such as a search or a calculation.

Can a 200 response have no body?

Yes, if the framing says the length is zero, but 204 No Content says it more clearly.

See also

Header and content rules

What RFC 9110 says about a 200 response, quoted from the RFC.

The same rule is in the response obligations table and its JSON.

2xx successful – the request was successfully received, understood, and accepted


HTTP status code lookup
REST API status code chooser
cURL command generator
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia