Skip to content

Instantly share code, notes, and snippets.

@paulschick
Created June 20, 2023 20:05
Show Gist options
  • Save paulschick/800da12356635783a59a88a13845a597 to your computer and use it in GitHub Desktop.
Save paulschick/800da12356635783a59a88a13845a597 to your computer and use it in GitHub Desktop.
HTTP Status Codes Cheat Sheet

HTTP Status Code Cheat Sheet

1xx: Informational

These codes indicate that the request was received and is being processed.

  • 100 Continue: The initial part of the request has been received, and the client should continue to send the rest of the request.
  • 101 Switching Protocols: The server is switching protocols as requested by the client.

2xx: Success

These codes indicate that the request was successfully received, understood, and accepted.

  • 200 OK: General success status code. Used for GET, PUT or DELETE requests when the operation was successful.
  • 201 Created: The request was successful, and a new resource was created. Typically used for POST requests.
  • 202 Accepted: The request has been accepted for processing, but processing is not complete.
  • 204 No Content: The server successfully processed the request, but there's no content to send in the response. Useful for DELETE requests.

3xx: Redirection

These codes indicate that further action is needed to complete the request.

  • 301 Moved Permanently: The resource requested has been permanently moved to a new URL.
  • 302 Found: Similar to 301, but the resource has been temporarily moved to a different URL.
  • 304 Not Modified: The resource has not been modified since the last request. Used for caching.

4xx: Client Errors

These codes are used when the client seems to have made an error.

  • 400 Bad Request: General error when the client sends a request that the server can't or won't process.
  • 401 Unauthorized: The client must authenticate itself to get the requested response.
  • 403 Forbidden: The client does not have permission to access the requested resource.
  • 404 Not Found: The server can't find the requested resource. Useful for GET requests where the resource does not exist.
  • 405 Method Not Allowed: The request method is known by the server but is not supported for the targeted resource.
  • 409 Conflict: The request conflicts with the current state of the server. Useful for POST/PUT when there's a conflict like a unique constraint violation.
  • 415 Unsupported Media Type: The media type of the request's payload is not supported by the server.
  • 422 Unprocessable Entity: The server understands the content type, and the syntax of the request is correct, but it was unable to process the contained instructions. Useful when validation fails.

5xx: Server Errors

These codes are used when the server fails to fulfill a valid request due to an error.

  • 500 Internal Server Error: General error indicating that something has gone wrong on the server.
  • 501 Not Implemented: The server does not support the functionality required to fulfill the request.
  • 502 Bad Gateway: The server is acting as a gateway or proxy and received an invalid response from the upstream server.
  • 503 Service Unavailable: The server is not ready to handle the request, usually because it is overloaded or under maintenance.
  • 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment