Understand HTTP Status Codes
HTTP status codes indicate the result of an HTTP request.
They are grouped into five categories:
1xx - Informational
The request has been received and processing continues.
2xx - Success
The request was successfully received and processed.
3xx - Redirection
Additional action is needed to complete the request.
4xx - Client Errors
The request contains an issue that prevents processing.
5xx - Server Errors
The server failed to process an otherwise valid request.
In REST API development, choosing appropriate status codes makes APIs easier to understand and integrate.
Important HTTP Status Codes
OK
The request completed successfully.
Created
A new resource was successfully created.
No Content
The operation succeeded without a response body.
Bad Request
The request contains invalid data.
Unauthorized
Authentication is missing or invalid.
Forbidden
The authenticated user does not have permission.
Not Found
The requested resource does not exist.
Conflict
The request conflicts with the current resource state.
Unprocessable Content
The request is syntactically valid but fails semantic validation.
Too Many Requests
The client exceeded a rate limit.
Internal Server Error
An unexpected server-side error occurred.
Service Unavailable
The server cannot currently handle the request.
Use 2xx status codes for successful operations.
Use 4xx status codes for client-side request problems.
Use 5xx status codes for server-side failures.
Choose status codes that accurately describe the result.