Thanks for reading my blog, if you would like to get notified on my next post, please subscribe.

LoneReor.com blog

HTTP Response Codes

HTTP Response Codes: A Quick Reference

When working with APIs or web services, understanding HTTP response codes is crucial. These status codes provide information about the outcome of an HTTP request. Below is a list of some common HTTP response codes.

1. Informational Responses (1xx)

These codes indicate that the request has been received and is being processed. They are rarely used in practice, but here are a few examples:

  • 100 Continue: The server acknowledges that it has received the initial part of the request.
  • 101 Switching Protocols: The server is switching to a different protocol (e.g., from HTTP to WebSocket).
    • 102 Processing (WebDAV): The server has received and is processing the request, but no response is available yet.
    • 103 Early Hints: Primarily used with the Link header to allow preloading resources while the server prepares a response.

2. Successful Responses (2xx)

These codes indicate that the request was successful. Some commonly encountered ones include:

  • 200 OK: The request was successful, and the server returned the expected data.
  • 201 Created: The request resulted in the creation of a new resource (e.g., after a successful POST request).
  • 202 Accepted: The request has been accepted for processing, but the server has not yet completed it. This is often used for asynchronous operations.
  • 203 Non-Authoritative Information: The server is a proxy and received the response from another source. It’s not the authoritative source for the requested resource.
  • 204 No Content: The server successfully processed the request, but there is no response body (e.g., for DELETE requests). 206 Partial Content: The server successfully fulfilled a partial GET request (e.g., for large files). The response includes only a portion of the resource.
    • 205 Reset Content: Tells the user agent to reset the document that sent the request.
    • 206 Partial Content: Used when the Range header requests only part of a resource.
    • 207 Multi-Status (WebDAV): Conveys information about multiple resources.

3. Redirection Responses (3xx)

These codes indicate that the client must take additional action to complete the request. Examples include:

  • 301 Moved Permanently: The requested resource has been permanently moved to a different URL.
  • 302 Found (or 303 See Other): Temporary redirection to another URL.
  • 307 Temporary Redirect: Similar to 302, but the client should continue using the original request method.

4. Client Error Responses (4xx)

These codes indicate that there was an error on the client side. Common ones include:

  • 400 Bad Request: The server couldn't understand the request due to malformed syntax.
  • 401 Unauthorized: Authentication is required, and the client failed to provide valid credentials.
  • 403 Forbidden: The client does not have permission to access the requested resource. ... read more 403
  • 404 Not Found: The requested resource does not exist. ... read more 404
  • 405 Method Not Allowed: The requested HTTP method (e.g., POST, PUT) is not allowed for the given resource.
  • 429 Too Many Requests: The client has exceeded the rate limit for requests. Retry after some time.

5. Server Error Responses (5xx)

These codes indicate that there was an error on the server side. Examples include:

  • 500 Internal Server Error: A generic error occurred on the server.
  • 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from an upstream server.
  • 503 Service Unavailable: The server is temporarily unable to handle requests (e.g., during maintenance).
  • 504 Gateway Timeout: The server, acting as a gateway, did not receive a timely response from an upstream server.