mytoolstash / developer tools / http-status-codes

$ curl -I

HTTP Status Codes

A plain-English reference to the status codes you'll actually meet while building and debugging web services.

1xx — Informational

100Continue — Request headers received; client should send the body.
101Switching Protocols — Server agrees to switch protocols, e.g. to WebSocket.

2xx — Success

200OK — The request succeeded.
201Created — A new resource was created, typically after POST.
204No Content — Success with no response body, common for DELETE.
206Partial Content — A byte-range response, used for downloads and video streaming.

3xx — Redirection

301Moved Permanently — Resource has a new permanent URL; browsers and search engines update.
302Found — Temporary redirect; the original URL should keep being used.
304Not Modified — Cached copy is still valid; no body returned.
307Temporary Redirect — Like 302 but the request method must not change.
308Permanent Redirect — Like 301 but the request method must not change.

4xx — Client errors

400Bad Request — Malformed syntax or invalid parameters.
401Unauthorized — Authentication required or failed.
403Forbidden — Authenticated but not allowed to access this resource.
404Not Found — The resource does not exist at this URL.
405Method Not Allowed — The HTTP method is not supported for this resource.
408Request Timeout — The client took too long to send the request.
409Conflict — The request conflicts with current state, e.g. duplicate entry.
413Payload Too Large — Request body exceeds the server limit.
415Unsupported Media Type — The Content-Type is not accepted.
422Unprocessable Entity — Well-formed request with semantic errors; common in REST APIs.
429Too Many Requests — Rate limit exceeded; check the Retry-After header.

5xx — Server errors

500Internal Server Error — Generic unhandled server failure.
501Not Implemented — The server does not support the request method.
502Bad Gateway — An upstream server returned an invalid response, common behind proxies.
503Service Unavailable — Server temporarily overloaded or down for maintenance.
504Gateway Timeout — An upstream server did not respond in time.

Reading the first digit

1xx informational, 2xx success, 3xx redirection, 4xx the client did something wrong, 5xx the server did. When debugging: a 4xx means fix the request; a 5xx means look at server logs.

The ones worth memorizing

200, 201, 301, 302, 304, 400, 401, 403, 404, 429, 500, 502, 503 cover the overwhelming majority of everything you'll ever see in logs and API responses.