The first digit of a status code names its family, which says whether the request worked and who is at fault. You can react to the family before reading the exact code.
2xx is success, like 200 OK or 201 Created.
3xx is a redirect, used when the resource moved or has not changed.
4xx is a client error, like 404 Not Found or 401 Unauthorized.
5xx is a server error on a valid request.
The family guides retries and blame. Resending a 4xx rarely helps, but a retry after a 5xx often works, since the fault sits on the server.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Saved in this browser - sign in to keep your review list.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Keep going - a few more words and AI can grade it.
Interview lens
How interviewers actually use this question
Likely follow-ups
What's the difference between 401 and 403, and how should a client react to each?401 means missing or invalid credentials, so authenticate and try again. 403 means the server refuses this caller, and the same credentials won't help.
Are any 4xx codes worth retrying? How would the client do it?Name 429 Too Many Requests and 408 Request Timeout. Say the client waits, honors a Retry-After header if one is sent, and backs off.
When would you return a 301 versus a 302?301 is permanent, so clients and search engines may cache it and update links. 302 is temporary, and clients keep using the original URL.
Your API returns 200 with an error message in the body. What breaks?Clients, caches, monitoring and retry logic read the status code first, so failures can get cached, missed by alerts and never retried.
What you can say
The first digit of a status code names its family, and the family tells you whether the request worked and, if it failed, whose fault it was.
2xx is success, like 200 OK or 201 Created, and 3xx is a redirect, used when the resource moved or hasn't changed.
4xx is a client error, like 404 Not Found or 401 Unauthorized, so the problem is in the request itself.
5xx is a server error, which means the request was valid but the server failed to handle it.
In practice, a client can react to the family before it even reads the exact code.
That shapes retries too. Resending a 4xx unchanged rarely helps, but retrying after a 5xx often works because the fault was on the server.
Weak answers to avoid
Recites codes without the family ruleListing 200, 404 and 500 shows recall, not understanding. Lead with the rule that the first digit names the outcome and who is at fault, then give examples.
Retries every error the same wayResending a 400 or 404 unchanged just repeats the failure and adds load. Say a 4xx needs a fixed request, while a 5xx is often worth a retry with backoff.
Blames every 5xx on the app codeA 502 or 504 often comes from a proxy or gateway when an upstream fails or is slow, and a 503 can mean overload. Say the server side failed, then find which hop.
Interview lens
Likely follow-ups, what you can say, and the weak answers to avoid.