Client
API
API Contract
Client asks. API responds. Your UI updates.
2xx = success, 4xx = client issue, 5xx = server issue.

Status Codes Are Signals

A status code is the server speaking in shorthand. Your app should read that signal first before touching response data.

2xx Means Success

200 means OK. 201 means created. 204 means success with no body. Different success codes tell your UI what to do next.

4xx Means Request Problem

400 means bad request. 401 means not authenticated. 403 means authenticated but not allowed. 404 means not found.

5xx Means Server Problem

5xx codes usually mean the backend failed internally. Retry logic may help, but your app should still show a clear fallback UI.

Always Check response.ok

Never assume success. Parse body only after checking `ok` or status range. This prevents silent bugs and confusing UI states.

Return Useful Error Messages

A good API error gives code + message + context. That helps frontend teams display actionable feedback to real users.

Status Signals Decoded

You can now translate server responses into reliable UI behavior and better failure handling.

AlgoAnimator: Interactive Data Structures