# 401 vs 403 vs 404 vs 409 vs 422 vs 429: pick the right one

> 403 must not log your users out. Wrong status codes make clients retry forever or leak that a record exists.

Source: https://fullbytedeveloper.com/blog/status-pick
Published here: 2026-11-13

403 must not log your users out. Wrong status codes make clients retry forever, force a re-login that will not help, or leak that a private record exists. Cheat sheet checked Nov 8 against MDN.

## What the client should do

**401 Unauthorized:** No valid credentials. Response is sent with `WWW-Authenticate` [1]. Client: log in or refresh the token.

**403 Forbidden:** Authenticating again makes no difference [2]. Client: show no access, keep the session. Server may send 404 instead of 403 to hide that the resource exists.

**409 Conflict:** Conflict with current state [3]. Client: refetch, then merge. Do not auto-retry the same body.

**400 Bad Request vs 422 Unprocessable Content:** Broken syntax vs content the server cannot process [4][5]. Client: fix the input. Resending unchanged fails again.

**429 Too Many Requests:** A `Retry-After` header may be included [6]. Wait, then retry.

## Rule of thumb

Retry 429 and 503 after `Retry-After`. Retry 502/504 only if the request is idempotent [7]. Never auto-retry 400, 401, 403, 409 or 422 unchanged.

Send this to the backend friend whose API logs users out on a 403.

## Sources

1. [MDN: 401 Unauthorized](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/401)
2. [MDN: 403 Forbidden](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403)
3. [MDN: 409 Conflict](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/409)
4. [MDN: 400 Bad Request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/400)
5. [MDN: 422 Unprocessable Content](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/422)
6. [MDN: 429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/429)
7. [RFC 9110: idempotent methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.2)
