Reference

HTTP Status Codes Reference

HTTP status codes explained for API response debugging, failed fetch calls, redirects, webhook retries and browser network panels.

Overview

HTTP status codes are the first clue when an API response does not match what the frontend or integration expects. This reference focuses on codes developers commonly see while debugging copied responses, failed fetch calls, webhook retries and browser network panels.

Debugging Reference Table

CodeMeaningAPI debugging note
200 OKRequest succeededThe payload can still be malformed, empty or the wrong content type. Validate the response body next.
201 CreatedResource createdCheck the response body and Location header when a client expects the new resource ID.
204 No ContentSuccess with no bodyCalling response.json() on a 204 response often causes parsing errors.
301 / 302RedirectFetch or API clients may follow redirects and receive HTML instead of JSON.
400 Bad RequestInvalid client requestInspect encoded query values, JSON syntax and required fields.
401 UnauthorizedMissing or invalid authenticationCheck Authorization headers, expired tokens and environment-specific credentials.
403 ForbiddenAuthenticated but not allowedAuthentication may be valid while permissions, scopes or IP restrictions fail.
404 Not FoundResource or route missingVerify base URL, route parameters, deployment environment and trailing slash behavior.
409 ConflictState conflictCommon for duplicate writes, version mismatches or idempotency problems.
415 Unsupported Media TypeRequest body type rejectedUsually caused by missing or wrong Content-Type when sending JSON.
422 Unprocessable ContentSyntax accepted but semantic validation failedInspect field-level validation errors in the response payload.
429 Too Many RequestsRate limit exceededCheck retry-after headers and whether client retries are too aggressive.
500 Internal Server ErrorServer failed unexpectedlyCapture request ID, input payload and server logs if available.
502 / 503 / 504Gateway or upstream failureOften points to proxy, timeout, deployment or upstream API availability issues.

Reference Table Coverage

  • Success responses that still break JSON parsing.
  • Authentication and permission failures.
  • Payload, validation and content-type errors.
  • Rate limits and upstream failures.

API Debugging Examples

  • A 204 response causes JSON.parse or response.json() to fail because there is no body.
  • A 302 redirect returns an HTML login page to a client expecting JSON.
  • A 415 response appears after sending JSON without the application/json Content-Type header.

Common Mistakes

  • Treating any 2xx response as parseable JSON.
  • Debugging only the body while ignoring status and headers.
  • Confusing 401 authentication failures with 403 authorization failures.
  • Retrying 429 responses without checking rate-limit headers.

FAQ

Can a 200 response still be an API bug?

Yes. A 200 response only says the request succeeded at the HTTP layer. The body may still be malformed, empty or semantically wrong.

Why does response.json() fail on 204?

A 204 response has no content. The client should skip JSON parsing or handle the empty body explicitly.

What should I check first for a 415 response?

Check the Content-Type header and make sure the request body matches what the API expects.