200 OK
Success - The request succeeded
HTTP 200 OK
What It Means
The HTTP 200 OK status code indicates that the request has succeeded. The meaning of "success" depends on the HTTP method:
- GET: The resource was fetched and transmitted in the message body
- POST: The resource describing the result of the action is transmitted in the message body
- PUT/PATCH: The resource was successfully updated
When to Use 200
Use 200 OK when:
- Returning data from a GET request
- A POST/PUT/PATCH successfully modified a resource and you're returning the updated data
- A search query returns results (even if empty)
200 vs Other Success Codes
| Code | When to Use |
|---|---|
| 200 | Request succeeded, returning data |
| 201 | Resource created (POST) |
| 204 | Success, no content to return (DELETE) |
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=3600
{
"id": 123,
"name": "Example Resource",
"status": "active"
}
Best Practices
- Always include a response body for GET requests
- Set appropriate Cache-Control headers for cacheable responses
- Use 201 instead of 200 when creating new resources
- Use 204 instead of 200 when there's no content to return