Pcornel
Automation · APIs

HTTP Status Codes

Cheat sheet · https://pcornel.dk/topic.php?topic=5300

Back to the Topic

Answer

Classification of transport/application response outcomes using HTTP status codes together with API-specific error bodies and operation state.

Remember

  • 2xx ≠ business success; accepted or partial application workflows can still fail later.
  • 4xx ≠ always client bug; authorization, quota, concurrency and policy can make the same request valid in another context.
  • 5xx ≠ safe retry automatically; the server may have committed a side effect before failing the response.
  • Status code ≠ complete diagnosis; structured error body, headers and request ID often identify the real boundary.

First checks

  • curl -sS -o /dev/null -w '%{http_code}\n' <url> — status code
  • Handling: 2xx success, 4xx client error, 5xx server error — classification
  • Retry only 429/5xx/timeouts — policy

Verify in this order

response → status class → handling

Where it usually breaks

The HTTP status identifies the response class for one request; it does not prove whether a side effect occurred before the response failed.

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

HTTP Status Codes API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5300

Confirmation

Confirm action

Continue?