HTTP Status Codes & Methods Reference

Complete reference for status codes, methods, headers, and CORS   = most common

1xx -- Informational
100Continue -- server received headers, send body
101Switching Protocols -- upgrading (e.g. to WebSocket)
102Processing -- request received, still working (WebDAV)
103Early Hints -- preload resources before final response
2xx -- Success
200 OK -- standard success response
201 Created -- resource created (POST success)
202Accepted -- request accepted, processing async
203Non-Authoritative Info -- modified by proxy
204 No Content -- success, no body (DELETE response)
205Reset Content -- clear the form
206Partial Content -- range request (video streaming)
3xx -- Redirection
300Multiple Choices -- multiple options available
301 Moved Permanently -- URL changed forever (SEO)
302 Found -- temporary redirect (keeps POST as GET)
303See Other -- redirect with GET after POST
304 Not Modified -- use cached version
307Temporary Redirect -- like 302, preserves method
308Permanent Redirect -- like 301, preserves method
4xx -- Client Errors
400 Bad Request -- malformed syntax / invalid data
401 Unauthorized -- auth required (no/bad credentials)
402Payment Required -- reserved for future use
403 Forbidden -- authenticated but not allowed
404 Not Found -- resource doesn't exist
405Method Not Allowed -- wrong HTTP method
406Not Acceptable -- can't match Accept header
407Proxy Auth Required
408Request Timeout -- client too slow
409 Conflict -- resource state conflict (e.g. duplicate)
410Gone -- resource permanently deleted
411Length Required -- Content-Length missing
412Precondition Failed -- conditional header failed
413Payload Too Large -- body exceeds limit
414URI Too Long
415Unsupported Media Type -- wrong Content-Type
416Range Not Satisfiable
418I'm a Teapot -- (RFC 2324, April Fools)
422 Unprocessable Entity -- validation error
429 Too Many Requests -- rate limited
451Unavailable for Legal Reasons
5xx -- Server Errors
500 Internal Server Error -- generic server failure
501Not Implemented -- method not supported
502 Bad Gateway -- upstream server sent bad response
503 Service Unavailable -- overloaded / maintenance
504Gateway Timeout -- upstream server timed out
505HTTP Version Not Supported
507Insufficient Storage (WebDAV)
508Loop Detected (WebDAV)
511Network Authentication Required (captive portal)
HTTP Methods
GETRetrieve resource. No body. Safe, idempotent, cacheable.
POSTCreate resource / submit data. Has body. Not idempotent.
PUTReplace entire resource. Idempotent. Has body.
PATCHPartial update. Has body. Not necessarily idempotent.
DELETERemove resource. Idempotent. Usually no body.
HEADLike GET but no response body. Check existence/headers.
OPTIONSDescribe communication options. Used in CORS preflight.
TRACEEcho request back. Debugging. Usually disabled.
CONNECTEstablish tunnel (HTTPS through proxy).
REST API Conventions:
GET    /users      List all users
GET    /users/42   Get user 42
POST   /users      Create new user
PUT    /users/42   Replace user 42
PATCH  /users/42   Update user 42 partially
DELETE /users/42   Delete user 42
Common Request Headers
AcceptMedia types client accepts (application/json)
AuthorizationCredentials (Bearer <token>, Basic ...)
Content-TypeBody format (application/json, multipart/form-data)
Content-LengthSize of request body in bytes
CookieSend stored cookies
User-AgentClient software identifier
Accept-EncodingSupported compression (gzip, br, deflate)
Accept-LanguagePreferred languages (en-US,en;q=0.9)
If-None-MatchETag for conditional request (caching)
If-Modified-SinceDate for conditional request (caching)
RefererURL of referring page
X-Requested-WithXMLHttpRequest (AJAX identifier)
Common Response Headers
Content-TypeResponse body format
Set-CookieSet a cookie on the client
LocationRedirect URL (with 3xx)
ETagResource version identifier (caching)
Last-ModifiedWhen resource was last changed
WWW-AuthenticateAuth method required (with 401)
Retry-AfterSeconds to wait (with 429 / 503)
X-RateLimit-*Rate limit info (Limit, Remaining, Reset)
Cache-Control Directives
Cache-Control: public, max-age=31536000
Cache-Control: private, no-cache
Cache-Control: no-store

public       Any cache can store
private      Only browser cache
no-cache     Must revalidate with server
no-store     Never cache (sensitive data)
max-age=N    Fresh for N seconds
s-maxage=N   CDN/proxy max age
immutable    Never changes (versioned assets)
must-revalidate  Stale = must check server
CORS Headers
Access-Control-Allow-OriginAllowed origin (* or specific)
Access-Control-Allow-MethodsAllowed HTTP methods
Access-Control-Allow-HeadersAllowed request headers
Access-Control-Max-AgePreflight cache duration (sec)
Access-Control-Allow-CredentialsAllow cookies cross-origin
Preflight flow (OPTIONS):
1. Browser sends OPTIONS with Origin header
2. Server responds with Access-Control-* headers
3. If allowed, browser sends actual request
Common Content Types (MIME)
application/jsonJSON data
application/xmlXML data
text/htmlHTML document
text/plainPlain text
text/cssCSS stylesheet
application/javascriptJavaScript
multipart/form-dataFile uploads
application/x-www-form-urlencodedForm data
application/octet-streamBinary data
image/png, image/jpegImages
ZeroKit.dev — Developer Cheatsheet Bundle