HTTP/REST API response status codes


1xx — Informational

Code Meaning Typical Use
100 Continue Server received request headers; client can send body Used in large file uploads
101 Switching Protocols Protocol change (e.g., HTTP → WebSocket) Rare in REST APIs

 2xx — Success

Code Meaning When Used
200 OK Request succeeded Standard success for GET, PUT, PATCH, or POST (no new resource)
201 Created Resource created successfully After a POST creating new resource
202 Accepted Request accepted for async processing Async or background jobs
204 No Content Success, no response body DELETE success or PUT with no content to return



3xx — Redirection

Code Meaning When Used
301 Moved Permanently Resource URL changed permanently Rare in APIs
302 Found Temporary redirect Sometimes used for login redirects
304 Not Modified Cached content still valid Used with caching headers (ETag, If-Modified-Since)

4xx — Client Errors

Code Meaning When Used
400 Bad Request Invalid input or malformed JSON Missing parameters, invalid field format
401 Unauthorized Authentication required or token invalid Missing/expired token
403 Forbidden Authenticated but no permission Token valid, but lacks required role/scope
404 Not Found Resource doesn’t exist Wrong URL or ID
405 Method Not Allowed Wrong HTTP method e.g., POST used instead of GET
409 Conflict Resource conflict e.g., Duplicate user or record
415 Unsupported Media Type Wrong content type e.g., Expecting application/json
422 Unprocessable Entity Validation error Input valid JSON but invalid data
429 Too Many Requests Rate limiting Gateway/API throttling

5xx — Server Errors

Code Meaning When Used
500 Internal Server Error Server-side exception Generic backend failure
501 Not Implemented Endpoint not implemented Placeholder APIs
502 Bad Gateway Upstream service failure In microservice/API Gateway setups
503 Service Unavailable Server temporarily overloaded Maintenance or scaling downtime
504 Gateway Timeout Upstream did not respond Slow backend call or timeout

Comments

Popular posts from this blog

gNMI_with_grafana on containerlabs

EVPN Route type-1 & type-4 in action

Network Automation with ROBOT Framework