HTTP Status Codes Cheat Sheet

Here’s a cheat sheet for commonly used HTTP status codes:

Informational Responses (1xx)

  • 100 Continue:
    • The server has received the initial part of the request, and the client should proceed with the rest.
  • 101 Switching Protocols:
    • The server is indicating a change in protocol, and the client should switch to the new protocol.

Successful Responses (2xx)

  • 200 OK:
    • The request was successful.
  • 201 Created:
    • The request was successful, and a new resource was created.
  • 204 No Content:
    • The request was successful, but there is no new information to send back.

Redirection Messages (3xx)

  • 300 Multiple Choices:
    • The requested resource has multiple representations, and the user or agent can choose the one it prefers.
  • 301 Moved Permanently:
    • The requested resource has been permanently moved to a new location.
  • 304 Not Modified:
    • Indicates that the resource has not been modified since the last requested time, and there is no need to retransmit the requested resource.

Client Error Responses (4xx)

  • 400 Bad Request:
    • The server could not understand the request due to malformed syntax or invalid request message framing.
  • 401 Unauthorized:
    • The request requires user authentication.
  • 403 Forbidden:
    • The server understood the request, but it refuses to authorize it.
  • 404 Not Found:
    • The server cannot find the requested resource.
  • 405 Method Not Allowed:
    • The method specified in the request is not allowed for the resource identified by the request URI.

Server Error Responses (5xx)

  • 500 Internal Server Error:
    • A generic error message indicating that the server encountered an unexpected condition that prevented it from fulfilling the request.
  • 501 Not Implemented:
    • The server does not support the functionality required to fulfill the request.
  • 503 Service Unavailable:
    • The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.

Custom Status Codes

  • 418 I’m a teapot:
    • A joking status code, indicating that the server refuses to brew coffee because it is, permanently, a teapot.
  • 451 Unavailable For Legal Reasons:
    • Indicates that the server is denying access to the resource as a consequence of a legal demand.

Note

  • HTTP status codes are three-digit numbers grouped into different classes (1xx, 2xx, 3xx, 4xx, 5xx) to indicate the outcome of an HTTP request.
  • The first digit of the status code defines the class of response, while the last two digits do not have any categorization role.
  • Familiarizing yourself with these codes can be helpful for understanding and troubleshooting HTTP interactions.

This cheat sheet covers some common HTTP status codes, but there are many more. Refer to the official HTTP Status Code Definitions for a comprehensive list.