About
The HTTP 200 OK successful response status code indicates that a request has succeeded. A 200 OK response is cacheable by default1.
200 OK response depending on HTTP request method
A 200 OK response has a different meaning and format depending on the HTTP request method .
Here is how they vary for different methods :
- GET : a resource was retrieved by the server and included in the response body
- POST : an action succeeded; the response has a message body describing the result
- HEAD : identical to GET , except there is no message body
- TRACE : the response has a message body containing the request as received by the server
Although possible, successful PUT or DELETE requests often do not result in a 200 OK response . It is more common to see 201 Created if the resource is uploaded or created for the first time, or 204 No Content upon successful deletion of a resource .
Status
200 OK
Examples
Receivig a 200 OK
for a GET
request
In this example, a successful GET request
to https://example.com
returns a 200 OK response
. The response includes representation headers
and a message body
with the HTML
content:
HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 294510
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Thu, 08 May 2025 21:57:00 GMT
Etag: "3147526947"
Expires: Thu, 08 May 2025 21:57:00 GMT
Last-Modified: Thu, 08 May 2025 21:58:00 GMT
Server: ECAcc (nyd/D10E)
X-Cache: HIT
Content-Length: 1234
<!doctype html>
<!-- HTML content follows here -->
Receiving 200 OK
for a POST
request in form submission
Assuming a form exists to send data
to an endpoint
for managing subscriptions
at http://example.com/subscribe
. A POST request
to subscribe
a user
may look like the following:
POST /subscribe HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 50
name=Jack%20Doe&email=jack.doe%40example.com
In this example, a response
with a 200 OK
status
could look like this:
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "User subscription pending. A confirmation email has been sent.",
"subscription": {
"name": "Jack Doe",
"email": "jack.doe@example.com",
"id": 123,
"feed": "default"
}
}
Anki
Links
References
MDN. “200 OK”. Available at: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200 . (Accessed: ). ↩︎