200 OK
The request succeeded. What the body contains depends on the method: a GET returns the resource, a POST returns the result of the action.
At a glance
- Status code
- 200 OK
- Class
- 2xx, success, the request was received and accepted
- Defined in
- RFC 9110
- Cacheable by default
- yes
- Response body
- Yes, and its meaning depends on the request method.
In detail
200 is the default success. For GET and HEAD the payload is the target resource. For POST or PUT it is a representation of the outcome, which is why a 200 to a POST is not the same statement as a 201.
Do not use 200 to report an application-level failure. A JSON body of {"error":"not found"} under a 200 defeats every cache, retry policy and monitor between the client and the server, all of which read the status line and not the body.
If a client treats a successful response as an error, check the Content-Type before suspecting the status. A 200 with the wrong media type is the more common fault.
Examples
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=60
{"id":41,"state":"active"}Things that catch people out
- A 200 is cacheable by default. Returning per-user content without Cache-Control: private is how one user's data ends up in another user's browser through a shared proxy.
- Returning 200 for an empty search result is correct. Returning 404 for it is not: the collection endpoint exists, it simply matched nothing.
Try it: HTTP Request Builder
Build a request with any method, headers and body, send it, and read the status line the server returns.
HTTP Request Builder
LOCAL · Browser-OnlyBuild and test HTTP requests with custom headers and body
Authentication
Headers
Generate Code
curl -X GET 'https://api.example.com/endpoint' \
-H 'Content-Type: application/json'Showing a sample URL. Enter your endpoint above to update the snippet.
Related HTTP status codes
All http status codes →201 Created
The request succeeded and created one or more new resources. The Location header carries the URL of the primary one.
204 No Content
The request succeeded and there is deliberately nothing to send back. The browser stays on the current page.
206 Partial Content
The server is returning part of the resource because the request carried a Range header. This is what makes resumable downloads and video seeking work.
202 Accepted
The request was accepted for processing but is not finished, and may still fail. Nothing has necessarily happened yet.
203 Non-Authoritative Information
The request succeeded, but a proxy between you and the origin server altered the response body or headers.
205 Reset Content
The request succeeded and the client should clear the form that sent it, ready for another entry.
Tools for this
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL