[{"data":1,"prerenderedAt":325},["ShallowReactive",2],{"tool-content-http-status-codes":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":7,"slug":9,"faqs":10,"body":32,"_type":318,"_id":319,"_source":320,"_file":321,"_stem":322,"_extension":323,"sitemap":324},"\u002Ftools\u002Fhttp-status-codes","tools",false,"","Http Status Codes","http-status-codes",[11,14,17,20,23,26,29],{"q":12,"a":13},"What is an HTTP status code?","An HTTP status code is a three-digit number returned by a server in response to a client's request. The first digit indicates the response class — 1xx is informational, 2xx is success, 3xx is redirection, 4xx is a client error, and 5xx is a server error. Status codes allow clients to understand what happened to their request without parsing the response body.",{"q":15,"a":16},"What is the difference between 401 and 403?","401 Unauthorized means the client is not authenticated — they haven't logged in or their credentials are invalid. Despite the name \"Unauthorized\", it really means \"Unauthenticated\". 403 Forbidden means the client is authenticated but doesn't have permission to access the resource — they're logged in but not allowed. Think of 401 as \"I don't know who you are\" and 403 as \"I know who you are, but you can't come in.\"",{"q":18,"a":19},"What is the difference between 301 and 302 redirects?","301 (Moved Permanently) tells browsers and search engines that the resource has permanently moved. Browsers cache this redirect, and search engines transfer ranking signals to the new URL. 302 (Found\u002FTemporary Redirect) indicates a temporary redirect — browsers don't cache it, and search engines don't transfer ranking. Use 301 for permanent URL changes like HTTP to HTTPS, and 302 for temporary redirects.",{"q":21,"a":22},"What does 429 Too Many Requests mean for API usage?","A 429 response means you've exceeded the API's rate limit — too many requests in a given time window. The response usually includes a Retry-After header indicating when you can try again, and X-RateLimit headers showing your limit and remaining quota. Implement exponential backoff in your code to handle 429 responses gracefully.",{"q":24,"a":25},"What should I return when a resource is not found vs when a user lacks permission?","Return 404 when the resource genuinely doesn't exist for any user. Return 403 when the resource exists but the requesting user lacks permission. However, for sensitive resources, it's sometimes better to return 404 even when the resource exists but the user lacks permission — this prevents information disclosure about which resources exist.",{"q":27,"a":28},"What is the 418 status code?","418 \"I'm a teapot\" is an April Fools' joke status code from RFC 2324 (Hyper Text Coffee Pot Control Protocol). It means \"I am a teapot; I cannot brew coffee\". Despite being a joke, it's in the official IANA registry and some developers use it for easter eggs. It has no practical use in real APIs.",{"q":30,"a":31},"What is the difference between 500 and 503?","500 Internal Server Error is a generic catch-all for unexpected server-side errors — unhandled exceptions, misconfigurations, bugs. The server encountered an error it didn't know how to handle. 503 Service Unavailable means the server is intentionally unable to handle requests — due to maintenance, overload, or a dependency being down. 503 implies the condition is temporary and includes a Retry-After header when possible.",{"type":33,"children":34,"toc":311},"root",[35,44,50,55,61,72,82,92,98,108,118,128,138,148,154,159],{"type":36,"tag":37,"props":38,"children":40},"element","h2",{"id":39},"what-are-http-status-codes",[41],{"type":42,"value":43},"text","What are HTTP status codes?",{"type":36,"tag":45,"props":46,"children":47},"p",{},[48],{"type":42,"value":49},"HTTP status codes are standardized three-digit codes that servers return with every HTTP response. They communicate, at a glance, whether a request succeeded, failed, or requires additional action. Understanding them is fundamental to web development, API integration, and debugging.",{"type":36,"tag":45,"props":51,"children":52},{},[53],{"type":42,"value":54},"Status codes are grouped into five classes based on their first digit. This lets you quickly categorize a response even if you don't recognise the specific code.",{"type":36,"tag":37,"props":56,"children":58},{"id":57},"how-to-use-this-reference",[59],{"type":42,"value":60},"How to use this reference",{"type":36,"tag":45,"props":62,"children":63},{},[64,70],{"type":36,"tag":65,"props":66,"children":67},"strong",{},[68],{"type":42,"value":69},"Search",{"type":42,"value":71}," by code number or keyword — typing \"redirect\" shows all 3xx codes, typing \"500\" shows server error codes, typing \"auth\" shows authentication-related codes.",{"type":36,"tag":45,"props":73,"children":74},{},[75,80],{"type":36,"tag":65,"props":76,"children":77},{},[78],{"type":42,"value":79},"Filter by category",{"type":42,"value":81}," using the buttons to focus on a specific class of responses.",{"type":36,"tag":45,"props":83,"children":84},{},[85,90],{"type":36,"tag":65,"props":86,"children":87},{},[88],{"type":42,"value":89},"Click any code",{"type":42,"value":91}," to expand it and see the full description with practical examples.",{"type":36,"tag":37,"props":93,"children":95},{"id":94},"the-five-status-code-classes",[96],{"type":42,"value":97},"The five status code classes",{"type":36,"tag":45,"props":99,"children":100},{},[101,106],{"type":36,"tag":65,"props":102,"children":103},{},[104],{"type":42,"value":105},"1xx Informational",{"type":42,"value":107}," — the request was received and the process is continuing. These are rarely seen in normal browsing.",{"type":36,"tag":45,"props":109,"children":110},{},[111,116],{"type":36,"tag":65,"props":112,"children":113},{},[114],{"type":42,"value":115},"2xx Success",{"type":42,"value":117}," — the request was successfully received, understood, and accepted. 200 OK is the most common response for successful requests.",{"type":36,"tag":45,"props":119,"children":120},{},[121,126],{"type":36,"tag":65,"props":122,"children":123},{},[124],{"type":42,"value":125},"3xx Redirection",{"type":42,"value":127}," — further action is needed to complete the request, usually by following a redirect to a new URL.",{"type":36,"tag":45,"props":129,"children":130},{},[131,136],{"type":36,"tag":65,"props":132,"children":133},{},[134],{"type":42,"value":135},"4xx Client Errors",{"type":42,"value":137}," — the request contains bad syntax or cannot be fulfilled by the server. The problem is on the client side. 404 Not Found is the most recognizable example.",{"type":36,"tag":45,"props":139,"children":140},{},[141,146],{"type":36,"tag":65,"props":142,"children":143},{},[144],{"type":42,"value":145},"5xx Server Errors",{"type":42,"value":147}," — the server failed to fulfill an apparently valid request. The problem is on the server side.",{"type":36,"tag":37,"props":149,"children":151},{"id":150},"status-codes-in-rest-api-design",[152],{"type":42,"value":153},"Status codes in REST API design",{"type":36,"tag":45,"props":155,"children":156},{},[157],{"type":42,"value":158},"Good API design uses status codes semantically — the code alone should communicate what happened:",{"type":36,"tag":160,"props":161,"children":162},"ul",{},[163,192,218,243,260,285,298],{"type":36,"tag":164,"props":165,"children":166},"li",{},[167,174,176,182,184,190],{"type":36,"tag":168,"props":169,"children":171},"code",{"className":170},[],[172],{"type":42,"value":173},"GET \u002Fusers\u002F123",{"type":42,"value":175}," → ",{"type":36,"tag":168,"props":177,"children":179},{"className":178},[],[180],{"type":42,"value":181},"200 OK",{"type":42,"value":183}," with user data, or ",{"type":36,"tag":168,"props":185,"children":187},{"className":186},[],[188],{"type":42,"value":189},"404 Not Found",{"type":42,"value":191}," if user doesn't exist",{"type":36,"tag":164,"props":193,"children":194},{},[195,201,202,208,210,216],{"type":36,"tag":168,"props":196,"children":198},{"className":197},[],[199],{"type":42,"value":200},"POST \u002Fusers",{"type":42,"value":175},{"type":36,"tag":168,"props":203,"children":205},{"className":204},[],[206],{"type":42,"value":207},"201 Created",{"type":42,"value":209}," with the new user and a ",{"type":36,"tag":168,"props":211,"children":213},{"className":212},[],[214],{"type":42,"value":215},"Location",{"type":42,"value":217}," header",{"type":36,"tag":164,"props":219,"children":220},{},[221,227,228,233,235,241],{"type":36,"tag":168,"props":222,"children":224},{"className":223},[],[225],{"type":42,"value":226},"PUT \u002Fusers\u002F123",{"type":42,"value":175},{"type":36,"tag":168,"props":229,"children":231},{"className":230},[],[232],{"type":42,"value":181},{"type":42,"value":234}," with updated user, or ",{"type":36,"tag":168,"props":236,"children":238},{"className":237},[],[239],{"type":42,"value":240},"204 No Content",{"type":42,"value":242}," if no body is returned",{"type":36,"tag":164,"props":244,"children":245},{},[246,252,253,258],{"type":36,"tag":168,"props":247,"children":249},{"className":248},[],[250],{"type":42,"value":251},"DELETE \u002Fusers\u002F123",{"type":42,"value":175},{"type":36,"tag":168,"props":254,"children":256},{"className":255},[],[257],{"type":42,"value":240},{"type":42,"value":259}," on success",{"type":36,"tag":164,"props":261,"children":262},{},[263,269,270,275,277,283],{"type":36,"tag":168,"props":264,"children":266},{"className":265},[],[267],{"type":42,"value":268},"POST \u002Flogin",{"type":42,"value":175},{"type":36,"tag":168,"props":271,"children":273},{"className":272},[],[274],{"type":42,"value":181},{"type":42,"value":276}," on success, ",{"type":36,"tag":168,"props":278,"children":280},{"className":279},[],[281],{"type":42,"value":282},"401 Unauthorized",{"type":42,"value":284}," for wrong credentials",{"type":36,"tag":164,"props":286,"children":287},{},[288,290,296],{"type":42,"value":289},"Validation failure → ",{"type":36,"tag":168,"props":291,"children":293},{"className":292},[],[294],{"type":42,"value":295},"422 Unprocessable Entity",{"type":42,"value":297}," with error details",{"type":36,"tag":164,"props":299,"children":300},{},[301,303,309],{"type":42,"value":302},"Rate limit exceeded → ",{"type":36,"tag":168,"props":304,"children":306},{"className":305},[],[307],{"type":42,"value":308},"429 Too Many Requests",{"type":42,"value":310}," with retry information",{"title":7,"searchDepth":312,"depth":312,"links":313},2,[314,315,316,317],{"id":39,"depth":312,"text":43},{"id":57,"depth":312,"text":60},{"id":94,"depth":312,"text":97},{"id":150,"depth":312,"text":153},"markdown","content:tools:http-status-codes.md","content","tools\u002Fhttp-status-codes.md","tools\u002Fhttp-status-codes","md",{"loc":4},1777882945760]