ā¤ Like
šŸ”– Save
šŸ”— Share
Eric Hu
Eric Hu

HTTP Status Codes

@thedevspaceio

🌐 The Language of HTTP

HTTP status codes are how servers tell clients what happened to their request. They are three-digit numbers that indicate success, failure, or the need for further action.


šŸ”„ 1xx – Informational

"Hold on, we're still working on it."

• 100 - Continue • 101 - Switching Protocols


āœ… 2xx – Success

"Everything worked exactly as expected."

• 200 - OK • 201 - Created • 202 - Accepted • 204 - No Content • 206 - Partial Content


ā†Ŗļø 3xx – Redirection

"What you're looking for is over there."

• 301 - Moved Permanently • 302 - Found • 303 - See Other • 304 - Not Modified • 307 - Temporary Redirect • 308 - Permanent Redirect


āŒ 4xx – Client Errors

"You might have made a mistake."

• 400 - Bad Request • 401 - Unauthorized • 403 - Forbidden • 404 - Not Found • 405 - Method Not Allowed • 409 - Conflict • 410 - Gone • 413 - Payload Too Large • 415 - Unsupported Media Type • 422 - Unprocessable Content • 429 - Too Many Requests


šŸ”„ 5xx – Server Errors

"Something went wrong on our side."

• 500 - Internal Server Error • 501 - Not Implemented • 502 - Bad Gateway • 503 - Service Unavailable • 504 - Gateway Timeout

#http #api #rest #statuscodes #webdev #backend #coding #tips


HTTP status codes are three-digit numbers returned by the server to indicate the result of a request.

CategoryMeaning
1xxInformational. Request received.
2xxSuccess. Request was fulfilled.
3xxRedirection. Further action needed.
4xxClient error. The request is wrong.
5xxServer error. The server failed.

2xx Success

The request was received, understood, and accepted.

CodeNameWhen to use
200OKStandard success for GET, PUT, PATCH, DELETE.
201CreatedA new resource was created (POST).
202AcceptedRequest accepted for async processing.
204No ContentSuccess, but nothing to return (DELETE).
206Partial ContentResponse to a range request (file downloads).

3xx Redirection

The client must take additional action to complete the request.

CodeNameWhen to use
301Moved PermanentlyResource has a new permanent URL. Update links.
302FoundTemporary redirect. Keep using the old URL.
303See OtherRedirect after POST to a GET endpoint.
304Not ModifiedCached version is still valid. Saves bandwidth.
307Temporary RedirectLike 302, but preserves the HTTP method.
308Permanent RedirectLike 301, but preserves the HTTP method.

4xx Client errors

The request contains bad syntax or cannot be fulfilled.

CodeNameWhen to use
400Bad RequestMalformed syntax or validation failed.
401UnauthorizedAuthentication required or failed.
403ForbiddenAuthenticated, but not allowed.
404Not FoundResource does not exist.
405Method Not AllowedHTTP method not supported for this endpoint.
409ConflictConflicts with current state (duplicate email).
410GoneResource existed but was permanently deleted.
413Payload Too LargeRequest body exceeds the limit.
415Unsupported Media TypeWrong Content-Type.
422Unprocessable ContentSyntax is fine, but semantics are invalid.
429Too Many RequestsRate limit exceeded.

5xx Server errors

The server failed to fulfill a valid request.

CodeNameWhen to use
500Internal Server ErrorGeneric server failure.
501Not ImplementedServer does not support the functionality.
502Bad GatewayUpstream server returned an invalid response.
503Service UnavailableServer is overloaded or down for maintenance.
504Gateway TimeoutUpstream server did not respond in time.

Full-Stack AI Developer Roadmap

From HTML & CSS to working with AI models, all in one structured roadmap.

@thedevspaceio
www.thedevspace.io