HTTP 200 OK Status Code

2xx Success · RFC 9110 §15.3.1 · Standard success response for GET, POST, PUT, and HEAD

200 OK RFC 9110 §15.3.1
Open /200/ →
Response & Header Builder
1m
max-age: 1m
Editable Response Body
Live Raw HTTP Response 7 headers · 92 bytes
HTTP/1.1 200 OK
Date: Tue, 24 Nov 2026 12:00:00 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 92
Cache-Control: public, max-age=60
Content-Type: application/json; charset=utf-8
ETag: "v1-8f4e2a9c"
X-Content-Type-Options: nosniff

{"status":"ok","data":{"id":"usr_01J9X4K2","active":true},"meta":{"request_id":"req_9f21a"}}
location /api/example {
    add_header Cache-Control "public, max-age=60" always;
    add_header ETag "\"v1-8f4e2a9c\"" always;
    add_header X-Content-Type-Options "nosniff" always;
    default_type application/json;
    return 200 '{"status":"ok","data":{"id":"usr_01J9X4K2","active":true},"meta":{"request_id":"req_9f21a"}}';
}
Pairwise HTTP Confusion Comparator
Open /http-status/201/ →
Attribute 200 OK 201 Created
Status & Phrase200 OK201 Created
Category2xx Success2xx Success
SpecificationRFC 9110 §15.3.1RFC 9110 §15.3.2
Core SemanticsIndicates that the HTTP request succeeded and the response payload represents the target resource or action result.The request succeeded and created one or more new resources; the primary resource URI should be returned in Location.
Cacheable by DefaultYesNo
Method PreservationN/AN/A
Safe to Auto-RetryNo (fix request first)No (fix request first)
Response Body AllowedYesYes
Key HeadersCache-Control, Content-Type, ETagLocation
HTTP 200 OK Content-Length: 92 B Cacheable · Non-retryable
Ctrl+Enter: Copy Raw · 100% Browser-Local
Advertisement
Reserved fixed-height slot (CLS = 0.00) 728×90 320×100 300×50

Designing Production HTTP 200 OK Responses Without Cache Leaks

Because RFC 9110 defines 200 OK as heuristically cacheable by default, omitting Cache-Control on authenticated API responses can allow shared proxies or CDNs to cache user-specific data if a Last-Modified header is present. Always declare Cache-Control: private, no-store on personalized JSON endpoints and pair public read endpoints with explicit max-age and ETag validators so clients can negotiate 304 Not Modified on subsequent polls.

For clean REST semantics, reserve 200 OK for successful reads and mutations that return a meaningful representation. When an endpoint creates a brand-new resource with a distinct URI, prefer 201 Created with a Location header; when a DELETE or PUT succeeds without needing to echo back bytes, return 204 No Content.

  • RFC SpecificationRFC 9110 §15.3.1 (Successful 2xx)
  • Default CacheabilityHeuristically cacheable by default unless Cache-Control restricts it
  • Idempotency & RetriesTerminal success — do not retry
When should I return 200 OK vs 201 Created vs 204 No Content?

Use 200 OK when returning a resource or action result body, 201 Created when a POST creates a new server-assigned resource (with a Location header), and 204 No Content when a mutation succeeds with no body.

Is an HTTP 200 response cached by browsers automatically?

Yes, GET responses with 200 OK are heuristically cacheable if Last-Modified is sent without Cache-Control. Set Cache-Control: no-store for sensitive data or explicit max-age values for deterministic CDN caching.

Why is returning {"error": true} with HTTP 200 considered an API anti-pattern?

Returning 200 on failures prevents HTTP monitoring, load balancers, browser fetch checks (res.ok), and API gateways from distinguishing healthy responses from broken ones, and risks caching error payloads in CDNs.