200 OK
The HTTP 200 OK status code indicates a successful request. The meaning of success and the accompanying message body vary based on the HTTP method used.
The response is cacheable by default. To override this behavior, the response needs to include the appropriate Cache-Control headers.
Usage
A 200 OK response always includes a message body, though the server is free to set the body length to zero. Depending on the server, this is expected when processing a PUT, DELETE, or OPTIONS request.
When the server has no content to return, the 204 status code is more appropriate. For requests creating a new resource, such as a POST creating content, a 201 status code is returned instead.
SEO impact
A 200 response passes content to Google's indexing pipeline, but indexing is not guaranteed. Google evaluates the content and decides independently whether to include the page in search results. A 200 response on a page saying content is missing or gone creates a soft 404. Too many soft 404s erode Google's trust in the site's server signals and negatively affects rankings.
GET
A GET response contains the message body of the requested resource.
Request
GET /document.pdf HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Length: 10000
<message body contains the requested PDF document>
HEAD
A HEAD response contains the same headers as a GET response, with no message body.
Request
HEAD / HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
POST
A POST response typically contains information about the result of the action or progress status.
Request
POST /api/data HTTP/1.1
Host: www.example.re
Content-Type: application/json
Content-Length: 24
{"name":"example entry"}
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18
{"success":"true"}
PUT
A PUT response typically contains information about the result of the action or progress status.
Request
PUT /api/data/1 HTTP/1.1
Host: www.example.re
Content-Type: application/json
Content-Length: 24
{"name":"updated entry"}
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18
{"success":"true"}
TRACE
A TRACE response contains the request message as the server received the request.
Request
TRACE / HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 200 OK
Content-Type: message/http
Content-Length: 38
TRACE / HTTP/1.1
Host: www.example.re
DELETE
A DELETE response includes a status indication of the completed action.
Request
DELETE /api/data/1 HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18
{"deleted":"true"}
OPTIONS
An OPTIONS response includes the Allow header listing the HTTP methods the server accepts. Optionally, the server specifies further details in the message body.
Request
OPTIONS / HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 200 OK
Allow: GET,HEAD,PUT,OPTIONS
Content-Type: text/plain;charset=UTF-8
Code references
.NET
HttpStatusCode.OK
Rust
http::StatusCode::OK
Rails
:ok
Go
http.StatusOK
Symfony
Response::HTTP_OK
Python3.5+
http.HTTPStatus.OK
Java
java.net.HttpURLConnection.HTTP_OK
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_OK
Angular
@angular/common/http/HttpStatusCode.Ok
Takeaway
The HTTP 200 OK status code indicates a successful request. Depending on the HTTP method, details or resources are included in the message body.
See also
- RFC 9110: HTTP Semantics
- Google: HTTP status codes and network errors
- Soft 404
- 201
- 204
- HTTP status codes