Skip to content

HTTP Response Status Codes

When integrating with backend APIs, the most common protocol web developers use is the Hypertext Transfer Protocol (HTTP). Knowing the most common HTTP response status code is crucial to building web applications.

Status Codes Grouping:

There are five classes of HTTP status codes:

  1. 1xx (Informational): The request was received, and the process is continuing.
  2. 2xx (Success): The request was successfully received, understood, and accepted.
  3. 3xx (Redirection): Further action needs to be taken to complete the request.
  4. 4xx (Client Error): The request contains bad syntax or cannot be fulfilled.
  5. 5xx (Server Error): The server failed to fulfill a valid request.

Most Common Status Codes

  • 200 OK : The request succeeded.
  • 201 Created: The request succeeded and a new resource was created usually through POST or PUT
  • `301 Moved Permanently: The requested URL has been changed permanently.
  • 302 Found: The requested URL has been changed temporarily.
  • 400 Bad Request: The request has client errors (e.g incorrect post body, validation errors)
  • 401 Unauthorized: The client has not been authenticated.
  • 403 Forbidden: The client does not have access rights for the requested content.
  • 404 Not Found: The requested resource i.e. URL cannot be found.
  • 500 Internal Server Error: A catch-all for an error in the server that cannot be handled.
  • 502 Bad Gateway: The gateway server got invalid response from the upstream server.
  • 503 Service Unavailable: The server is temporarily unavailable, usually caused by server maintenance or overload.
  • 504 Gateway Timeout: The gateway server did not get a response from the upstream server in time in order to complete the request.

There are many other standard status codes and also non-standard codes that the server may decide to return. Knowing the most common ones is a must for any frontend engineer.