← Back to Developer Tools
📡

HTTP 200 vs 201 vs 204 — When to Use Each Success Code

All 34 status codes · Search · Filter · Snippets · cURL Tester · Favorites

💡

Choosing between HTTP success codes — 200 OK, 201 Created, 202 Accepted, 204 No Content, and 206 Partial Content. Each has a distinct semantic meaning. Using the right code makes your REST API more predictable, easier to debug, and correctly handled by HTTP clients, caches, and monitoring tools.

1xx4
2xx5
3xx5
4xx13
5xx7
🌐 Live Status Checker
CORS-safe — works for public APIs and your own endpoints
100
Continue
Server received request headers, client should proceed
Upload
101
Switching Protocols
Server is switching to the protocol specified in Upgrade header
WebSocket
102
Processing
Server has received and is processing the request (WebDAV)
REST
103
Early Hints
Server sends preliminary hints for browser to preload resources
Cache
200
OK
Request succeeded — standard success response
RESTSuccess📦 Cacheable
201
Created
Request succeeded and a new resource was created
RESTSuccess
202
Accepted
Request accepted but processing not yet complete
REST
204
No Content
Request succeeded but no response body
RESTSuccess
206
Partial Content
Server is delivering only part of the resource (range request)
UploadCache📦 Cacheable
301
Moved Permanently
Resource permanently moved to new URL — use Location header
RedirectCache📦 Cacheable
302
Found
Resource temporarily at different URL — method may change
Redirect
304
Not Modified
Resource not changed since last request — use cached version
Cache📦 Cacheable
307
Temporary Redirect
Temporary redirect — HTTP method preserved
Redirect
308
Permanent Redirect
Permanent redirect — HTTP method preserved
RedirectCache📦 Cacheable
400
Bad Request
Server cannot process request due to client error
RESTError
401
Unauthorized
Client must authenticate to get the requested response
AuthError↺ Retryable
403
Forbidden
Client is authenticated but not authorized for this resource
AuthError
404
Not Found
Server cannot find the requested resource
RESTError📦 Cacheable
405
Method Not Allowed
HTTP method not allowed for this resource
RESTError
408
Request Timeout
Server timed out waiting for the request
Error↺ Retryable
409
Conflict
Request conflicts with current state of the server
RESTError↺ Retryable
410
Gone
Resource permanently deleted — unlike 404, this is intentional
RESTErrorCache📦 Cacheable
411
Length Required
Server requires Content-Length header
UploadError
413
Content Too Large
Request body exceeds server size limit
UploadError
415
Unsupported Media Type
Server rejects request due to unsupported Content-Type
RESTError
422
Unprocessable Content
Request is well-formed but has semantic errors (validation failed)
RESTError
429
Too Many Requests
Client has sent too many requests (rate limited)
AuthErrorREST↺ Retryable
500
Internal Server Error
Server encountered unexpected error
Error↺ Retryable
501
Not Implemented
Server does not support the functionality required
Error📦 Cacheable
502
Bad Gateway
Upstream server returned invalid response
Error↺ Retryable
503
Service Unavailable
Server temporarily unavailable — overloaded or down for maintenance
Error↺ Retryable
504
Gateway Timeout
Upstream server did not respond in time
Error↺ Retryable
507
Insufficient Storage
Server unable to store the representation (WebDAV)
UploadError↺ Retryable
511
Network Authentication Required
Client needs to authenticate to gain network access (captive portal)
AuthError↺ Retryable
📡

Click any status code to see full details, code snippets, and usage guide

NavigateEsc CloseCtrl+F Search
Ctrl+F Focus search Navigate codesEsc Close detailCtrl+L Clear filters

Frequently Asked Questions

When should I use 200 OK vs 201 Created?

Use 200 OK when a request succeeds and returns existing data — GET, PUT, PATCH responses. Use 201 Created when a POST request successfully creates a new resource. With 201, include a Location: /resources/new-id header pointing to the new resource and return the created object in the body. Using 200 for creation is technically valid but loses semantic clarity.

When should I use 204 No Content?

Use 204 when a request succeeds but there is nothing to return — DELETE operations (resource deleted, nothing to send back), PUT/PATCH when you choose not to return the updated resource, and heartbeat/ping endpoints. If you want to return a confirmation message or the deleted record's final state, use 200 instead.

What is 202 Accepted and when should I use it?

202 Accepted means the request was received and will be processed asynchronously. Use it for long-running operations — email sending, video encoding, data imports, report generation. Return a job ID and status polling URL: {"jobId": "abc123", "statusUrl": "/jobs/abc123", "estimatedTime": 30}. The client polls the status URL until the job is complete.

What is 206 Partial Content?

206 Partial Content is returned when a client requests only part of a resource using the Range header. Used by video players (seek to position), download managers (resume downloads), and large file streaming. The response includes Content-Range header indicating which bytes are included. Most HTTP clients handle this automatically when you set up byte-range serving correctly.

Does 204 have a response body?

No — 204 must not include a response body. This is specified in RFC 9110. Sending a body with 204 is a protocol violation. If you need to return data, use 200 instead. Some frameworks automatically strip the body if 204 is set. In Express: res.status(204).send() — do not use res.status(204).json({}), as that would technically violate the spec.

Which 2xx codes are cacheable?

Cacheable 2xx codes per RFC 9110: 200 OK (with appropriate Cache-Control), 203 Non-Authoritative, 204 No Content, 206 Partial Content. Non-cacheable by default: 201 Created (new resource — cache would be invalid immediately), 202 Accepted (async — result not yet known). Always use Cache-Control headers explicitly rather than relying on default cacheability.

You might also like

Related Tools