HTTP Codes

HTTP status codes are standardized response codes sent by web servers. I grouped them into five categories.

RangeCategory
1xxInformational
2xx 🟢Success
3xx 🟠Redirection
4xx šŸ”“Client Errors
5xx šŸ”“Server Errors

and the most used ones...

🟢 200  OK                    Request succeeded. Standard response for `GET`, `POST`, or `PUT`. 
🟢 201  Created               Resource successfully created. Common with `POST`.                
🟢 202  Accepted              Request accepted for processing, but not completed yet.           
🟢 204  No Content            Request succeeded, no response body. Often for `DELETE`.          
  
🟠 301  Moved Permanently     Resource has permanently moved. Use new URL.             
🟠 302  Found                 Temporary redirect. Browser should use the URL provided. 
🟠 304  Not Modified          Cached version is still valid. Saves bandwidth.          
🟠 307  Temporary Redirect    Same as 302 but preserves HTTP method.                   
 
šŸ”“ 400  Bad Request           Server cannot process malformed request.                                    
šŸ”“ 401  Unauthorized          Client must authenticate (e.g. via token).                                  
šŸ”“ 403  Forbidden             Client is authenticated but not authorized.                                 
šŸ”“ 404  Not Found             Resource does not exist.                                                    
šŸ”“ 405  Method Not Allowed    HTTP method is not supported by the resource.                               
šŸ”“ 409  Conflict              Request conflicts with current server state (e.g. duplicate record).        
šŸ”“ 422  Unprocessable Entity  Valid data structure, but semantically invalid (common in form validation). 
 
šŸ”“ 500  Internal Server Error Catch-all for unexpected server errors.                   
šŸ”“ 501  Not Implemented       Server does not support the requested functionality.      
šŸ”“ 502  Bad Gateway           Server received an invalid response from upstream server. 
šŸ”“ 503  Service Unavailable   Server is down or overloaded.                             
šŸ”“ 504  Gateway Timeout       Upstream server did not respond in time.                  

LinkIconHTTP Codes Dictionary

JavascriptIcon
/**
 * Dictionary of common HTTP status codes mapped to their numeric value.
 */
export const HttpsCode = {
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.1
	 *
	 * 🟢 The request has succeeded.
	 */
	OK: 200,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.2
	 *
	 * 🟢 The request has succeeded and a new resource has been created as a result.
	 * Often used in response to POST or PUT.
	 */
	CREATED: 201,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.3.5
	 *
	 * 🟢 The server successfully processed the request and is not returning any content.
	 * Often used in DELETE operations.
	 */
	NO_CONTENT: 204,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.2
	 *
	 * 🟠 This response code means that the URI of the requested resource has been changed permanently.
	 */
	MOVED_PERMANENTLY: 301,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3
	 *
	 * 🟠 This response code means that the URI of requested resource has been changed temporarily.
	 */
	FOUND: 302,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7232#section-4.1
	 *
	 * 🟠 Indicates that the resource has not been modified since the version specified by the request headers.
	 * Saves bandwidth by allowing cached content.
	 */
	NOT_MODIFIED: 304,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1
	 *
	 * šŸ”“ The server could not understand the request due to invalid syntax.
	 */
	BAD_REQUEST: 400,
 
	/**
	 * 401 Unauthorized
	 *
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7235#section-3.1
	 *
	 * šŸ”“ Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated".
	 * That is, the client must authenticate itself to get the requested response.
	 */
	UNAUTHORIZED: 401,
 
	/**
	 * 403 Forbidden
	 *
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.3
	 *
	 * šŸ”“ The client does not have access rights to the content; i.e., it is unauthorized, so the server is refusing to give the requested resource.
	 */
	FORBIDDEN: 403,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4
	 *
	 * šŸ”“ The server can not find the requested resource.
	 */
	NOT_FOUND: 404,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.5
	 *
	 * šŸ”“ The request method is known by the server but has been disabled and cannot be used for the resource.
	 */
	METHOD_NOT_ALLOWED: 405,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.8
	 *
	 * šŸ”“ This response is sent when a request conflicts with the current state of the server.
	 */
	CONFLICT: 409,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc4918#section-11.2
	 *
	 * šŸ”“ The request was well-formed but was unable to be followed due to semantic errors.
	 * Often used for validation errors.
	 */
	UNPROCESSABLE_ENTITY: 422,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.1
	 *
	 * šŸ”“ The server encountered an unexpected condition that prevented it from fulfilling the request.
	 */
	INTERNAL_SERVER_ERROR: 500,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.3
	 *
	 * šŸ”“ The server was acting as a gateway or proxy and received an invalid response from the upstream server.
	 */
	BAD_GATEWAY: 502,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.4
	 *
	 * šŸ”“ The server is not ready to handle the request. Common causes: server down or overloaded.
	 *
	 * Note that together with this response, a user-friendly page explaining the problem should be sent. This responses should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.
	 */
	SERVICE_UNAVAILABLE: 503,
 
	/**
	 * Official Documentation @ https://datatracker.ietf.org/doc/html/rfc7231#section-6.6.5
	 *
	 * šŸ”“ The server, while acting as a gateway, did not receive a response in time from the upstream server.
	 */
	GATEWAY_TIMEOUT: 504
}