7-day free trial — no payment today.

Common HTTP Status Codes in Node.js

Deep dive into the most important HTTP status codes used in real-world backend APIs, including success, redirection, client errors, and server errors.

What Are HTTP Status Codes

HTTP status codes are standardized numeric responses sent by servers to describe the result of a client request.

1. Purpose of Status Codes

Why every response must include a status code.

2. Status Code Categories

How status codes are classified.

1xx – Informational Status Codes

1xx status codes indicate that the request was received and is being processed.

1. 100 Continue

Request can continue.

2. 101 Switching Protocols

Protocol change.

2xx – Success Status Codes

2xx status codes confirm that the server handled the request successfully.

1. 200 OK

Standard success response.

2. 201 Created

Resource creation.

3. 202 Accepted

Request accepted for processing.

4. 204 No Content

Success with no body.

3xx – Redirection Status Codes

3xx status codes instruct the client to take additional action.

1. 301 Moved Permanently

Permanent redirect.

2. 302 Found

Temporary redirect.

3. 304 Not Modified

Caching optimization.

4xx – Client Error Status Codes

4xx status codes indicate that the client sent an invalid request.

1. 400 Bad Request

Invalid input.

2. 401 Unauthorized

Authentication required.

3. 403 Forbidden

Permission denied.

4. 404 Not Found

Resource missing.

5. 409 Conflict

State conflict.

6. 422 Unprocessable Entity

Semantic validation error.

7. 429 Too Many Requests

Rate limiting.

5xx – Server Error Status Codes

5xx status codes indicate that the server failed to process a valid request.

1. 500 Internal Server Error

Unexpected server failure.

2. 502 Bad Gateway

Invalid upstream response.

3. 503 Service Unavailable

Temporary outage.

4. 504 Gateway Timeout

Upstream timeout.

Status Codes in Real APIs

Correct status code usage improves API clarity, debugging, and client behavior.

1. Best Practices

Industry guidelines.

2. Client-side Impact

How clients react to status codes.