How should an API client interpret common 4xx status codes?
Quick answer
Treat a 4xx response as a clue that the server regards something about the request or its context as a client error, not as a complete explanation. For common cases: 400 suggests checking request details; 401, whether the request is authenticated; 403, whether access is allowed; 404, whether the resource can be found; 409, whether current server state conflicts with the request; and 422, whether the request’s meaning or values can be accepted. These are general HTTP meanings, not guarantees about an API’s error body or handling. [S1]
The question, the details, the next step.
A practical checklist
Record the status code and the operation that returned it.
Use the matching lookup entry to form one diagnostic question.
Compare the request with the endpoint’s documented expectations.
Treat the API’s own documentation and response details as context, not as guaranteed by the status code.
Note what remains unknown before changing the request or asking the API administrator.
A few more useful answers
Does a 404 always mean the resource does not exist?
No. The general meaning is that the resource was not found, but a server may use 404 instead of 403 to conceal a resource’s existence. [S1]
Does a 422 tell me which value is wrong?
Not by itself. Its general meaning points to a well-formed request that cannot be followed because of semantic errors; the status definition does not establish what details a particular API provides. [S1]
Are these meanings guaranteed to describe every API’s exact behavior?
No. They are general HTTP semantics, and the reference notes that servers may use additional non-standard codes. Check the specific API’s documentation for its own behavior. [S1]
Sources
References used for this guide.
- [S1] MDN HTTP Reference: HTTP response status codes developer.mozilla.org · Checked
