200 OK
The 200 OK status code indicates that a status code completed as requested. The meaning of the payload varies with the request method; typically the response is either information in response to a query, or a description of changes in response to an operation.
Writing responses (servers)
Aim to funnel clients to a 200 OK response, if a more specific 2xx code is not available.
A 200 response implies the following things about the request:
- The resource exists (if the resource was created by the request, see
201 Created
) - The client provided the correct credentials to perform the request, if necessary
If a server would normally send 200 OK
with a Content-Length: 0
, it can instead omit the Content-Length header field and return 204 No Content.
Reading responses (clients)
200 OK
indicates a successful response doesn't require any special considerations. Consult the request method description for the meaning of the response, and the Content-Type for how to parse the contents of the document.
Variations
The 200 status code is a generic status code, and a more specific status code should be used instead, if one exists. Clients will treat unknown 2xx status codes as a 200, so it's always acceptable to use a more specific version instead of 200:
- Responses with an empty body can be sent with
204 No Content
instead, this allows the server to omit the Content-Length header. - If the request has side effects on a resource besides this one, see
201 Created
or another 2xx header.
Overview table
- Name
- 200
- Message
- 200 OK
- Description
- The request completed as requested.
- Cachability
- Cachable by default
- Specification
- RFC 7231: HTTP/1.1 Semantics and Content ยง6.3.1. 200 OK
Example
HTTP/1.1 200 OK