
HTTP Status Codes
š The Language of HTTP
HTTP status codes are how servers tell clients what happened to their request. They are three-digit numbers that indicate success, failure, or the need for further action.
š 1xx ā Informational
"Hold on, we're still working on it."
⢠100 - Continue ⢠101 - Switching Protocols
ā 2xx ā Success
"Everything worked exactly as expected."
⢠200 - OK ⢠201 - Created ⢠202 - Accepted ⢠204 - No Content ⢠206 - Partial Content
āŖļø 3xx ā Redirection
"What you're looking for is over there."
⢠301 - Moved Permanently ⢠302 - Found ⢠303 - See Other ⢠304 - Not Modified ⢠307 - Temporary Redirect ⢠308 - Permanent Redirect
ā 4xx ā Client Errors
"You might have made a mistake."
⢠400 - Bad Request ⢠401 - Unauthorized ⢠403 - Forbidden ⢠404 - Not Found ⢠405 - Method Not Allowed ⢠409 - Conflict ⢠410 - Gone ⢠413 - Payload Too Large ⢠415 - Unsupported Media Type ⢠422 - Unprocessable Content ⢠429 - Too Many Requests
š„ 5xx ā Server Errors
"Something went wrong on our side."
⢠500 - Internal Server Error ⢠501 - Not Implemented ⢠502 - Bad Gateway ⢠503 - Service Unavailable ⢠504 - Gateway Timeout
#http #api #rest #statuscodes #webdev #backend #coding #tips
HTTP status codes are three-digit numbers returned by the server to indicate the result of a request.
| Category | Meaning |
|---|---|
| 1xx | Informational. Request received. |
| 2xx | Success. Request was fulfilled. |
| 3xx | Redirection. Further action needed. |
| 4xx | Client error. The request is wrong. |
| 5xx | Server error. The server failed. |
2xx Success
The request was received, understood, and accepted.
| Code | Name | When to use |
|---|---|---|
200 | OK | Standard success for GET, PUT, PATCH, DELETE. |
201 | Created | A new resource was created (POST). |
202 | Accepted | Request accepted for async processing. |
204 | No Content | Success, but nothing to return (DELETE). |
206 | Partial Content | Response to a range request (file downloads). |
3xx Redirection
The client must take additional action to complete the request.
| Code | Name | When to use |
|---|---|---|
301 | Moved Permanently | Resource has a new permanent URL. Update links. |
302 | Found | Temporary redirect. Keep using the old URL. |
303 | See Other | Redirect after POST to a GET endpoint. |
304 | Not Modified | Cached version is still valid. Saves bandwidth. |
307 | Temporary Redirect | Like 302, but preserves the HTTP method. |
308 | Permanent Redirect | Like 301, but preserves the HTTP method. |
4xx Client errors
The request contains bad syntax or cannot be fulfilled.
| Code | Name | When to use |
|---|---|---|
400 | Bad Request | Malformed syntax or validation failed. |
401 | Unauthorized | Authentication required or failed. |
403 | Forbidden | Authenticated, but not allowed. |
404 | Not Found | Resource does not exist. |
405 | Method Not Allowed | HTTP method not supported for this endpoint. |
409 | Conflict | Conflicts with current state (duplicate email). |
410 | Gone | Resource existed but was permanently deleted. |
413 | Payload Too Large | Request body exceeds the limit. |
415 | Unsupported Media Type | Wrong Content-Type. |
422 | Unprocessable Content | Syntax is fine, but semantics are invalid. |
429 | Too Many Requests | Rate limit exceeded. |
5xx Server errors
The server failed to fulfill a valid request.
| Code | Name | When to use |
|---|---|---|
500 | Internal Server Error | Generic server failure. |
501 | Not Implemented | Server does not support the functionality. |
502 | Bad Gateway | Upstream server returned an invalid response. |
503 | Service Unavailable | Server is overloaded or down for maintenance. |
504 | Gateway Timeout | Upstream server did not respond in time. |
Full-Stack AI Developer Roadmap
From HTML & CSS to working with AI models, all in one structured roadmap.