# 200 OK

> https://http-status.org/docs/200

**Family:** 2xx Success

## Rationale

Request has succeeded; payload depends on request method.

## In Plain Terms

Everything worked perfectly! The server understood your request and sent back exactly what you asked for.

## Description

The HTTP 200 OK status code indicates that the request has succeeded. The payload sent in the response depends on the request method. When a more specific 2xx code applies — 201 Created for resource creation, 204 No Content for empty success, 206 Partial Content for range responses — prefer the specific code over the generic 200.

## Server Perspective

### Usage
- Return 200 for successful GET requests with a representation
- Use it for updates when the response returns the updated resource
- Use it for actions that succeed and return a useful result
- Successful GET requests returning data
- Successful PUT/PATCH requests returning updated resource
- Successful POST requests when not creating a new resource
- Successful DELETE requests that return a representation of the outcome

### Implementation
- Return the resource or operation result in the body when one is useful
- Set Content-Type and cache headers appropriate to the representation
- 200 is heuristically cacheable by default; set Cache-Control to prevent caching when the response is user-specific or should not be stored

### Common Headers
- No status-specific header is required; include Content-Type, cache validators, and representation metadata when useful.

### Body
- Usually include the requested resource, updated resource, or action result

### Pitfalls
- Do not use 200 for successful empty responses where 204 communicates the contract better
- Do not hide partial failure inside a generic 200 unless the API explicitly models batch results
- Creating new resources (use 201 Created instead)
- Successful requests with no response body (use 204 No Content)
- Partial content responses (use 206 Partial Content)

## Client Perspective

### Pitfalls
- Do not assume every 200 response has a JSON body

## Examples

### Fetching user profile

Server successfully retrieved and returned the user's profile information

**Request:**
```
GET https://api.example.test/api/users/123
```

**Response:**
```
200 OK
Content-Type: application/json

{
  "id": 123,
  "name": "Example User"
}
```

## Related Codes

- [201 Created](/docs/201.md)
- [202 Accepted](/docs/202.md)
- [204 No Content](/docs/204.md)
- [205 Reset Content](/docs/205.md)
- [206 Partial Content](/docs/206.md)

