Home›Community›What are HTTP status codes every developer should know?
What are HTTP status codes every developer should know?
Coding Now Expert •
Jun 29, 2026 •
25 views
I'm learning web development and often see HTTP status codes like 200, 201, 301, 400, 401, 403, 404, and 500 when working with APIs and web applications. I understand they indicate the result of a request, but I'm not sure what each code means or when it should be returned.
Can someone explain the most common HTTP status codes, how they are grouped (1xx, 2xx, 3xx, 4xx, and 5xx), and provide real-world examples of when developers should use them in REST APIs and web applications?
0
1 Answers
karishma
Jun 29, 2026
HTTP status codes are three-digit numbers returned by a web server to indicate the outcome of a client's request. They help browsers, APIs, and applications understand whether a request was successful, redirected, invalid, or failed due to a server issue.
HTTP status codes are grouped into five categories:
1xx – Informational: The request has been received and processing continues.
2xx – Success: The request was successfully processed.
3xx – Redirection: Additional action is required to complete the request.
4xx – Client Errors: The request contains an error or cannot be fulfilled by the server.
5xx – Server Errors: The server encountered an error while processing a valid request.
Common HTTP Status Codes Every Developer Should Know
1xx – Informational
100 Continue
The initial part of the request has been received.
Mainly used internally between clients and servers.
2xx – Success
200 OK
The request was successful.
Commonly returned for successful GET, PUT, or PATCH requests.
Example:
GET /users/1
→ 200 OK
201 Created
A new resource was successfully created.
Typically returned after a successful POST request.
Example:
POST /users
→ 201 Created
204 No Content
The request succeeded, but there is no response body.
Often used after deleting a resource.
Example:
DELETE /users/1
→ 204 No Content
3xx – Redirection
301 Moved Permanently
The requested resource has permanently moved to a new URL.
Browsers automatically redirect future requests.
Example:
http://example.com
→ https://example.com
302 Found
Temporary redirect.
The resource is temporarily available at another location.
304 Not Modified
The requested resource has not changed since the last request.
Used with browser caching to improve performance.
4xx – Client Errors
400 Bad Request
The request is malformed or contains invalid data.
Example:
POST /users
{
"email": "invalid-email"
}
→ 400 Bad Request
401 Unauthorized
Authentication is required or the provided credentials are invalid.
Example:
Missing or invalid JWT token
→ 401 Unauthorized
403 Forbidden
The user is authenticated but does not have permission to access the resource.
Example:
Regular user trying to access an admin endpoint
→ 403 Forbidden
404 Not Found
The requested resource does not exist.
Example:
GET /users/999
→ 404 Not Found
405 Method Not Allowed
The requested HTTP method is not supported for the resource.
Example:
DELETE /login
→ 405 Method Not Allowed
409 Conflict
The request conflicts with the current state of the resource.
Example:
Creating a user with an email that already exists
→ 409 Conflict
422 Unprocessable Entity
The request format is correct, but validation fails.
Example:
Password is too short
Email is missing
→ 422 Unprocessable Entity
5xx – Server Errors
500 Internal Server Error
An unexpected error occurred on the server.
Example:
Database connection failed
Unhandled exception
→ 500 Internal Server Error
502 Bad Gateway
A gateway or proxy received an invalid response from an upstream server.
503 Service Unavailable
The server is temporarily unavailable due to maintenance or overload.
504 Gateway Timeout
The upstream server took too long to respond.
REST API Example
API Request Status Code Reason
GET /products 200 OK Products retrieved successfully
POST /products 201 Created Product created successfully
PUT /products/5 200 OK Product updated
DELETE /products/5 204 No Content Product deleted successfully
GET /products/999 404 Not Found Product doesn't exist