200

OK

2xx Success

Back to list

Server perspective

Use 200 when the request completed successfully and the response body represents the result.

When to use

  • 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

How to respond

  • Return the resource or operation result in the body when one is useful
  • Set Content-Type and cache headers appropriate to the representation

Headers to consider

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

Response body

  • Usually include the requested resource, updated resource, or action result

Server-side 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

Examples

Successful resource fetch

Request:GET /api/users/123
Response:200 OK with the user representation

The server found the resource and returns it as the response body.

References

Related 2xx Success Codes