HTTP Responses and Troubleshooting

HTTP Response Codes & API Troubleshooting Guide


Common HTTP Response Codes

Code Meaning What It Usually Means Common Cause
200 Success Request completed successfully API working correctly
201 Created Resource successfully created New user, session, or object created
400 Bad Request API could not process request Invalid JSON, missing fields, bad formatting
401 Unauthorized Authentication failed Invalid token, expired token, missing credentials
403 Forbidden Access denied User authenticated but lacks permissions
404 Not Found Resource or endpoint not found Wrong URL or API endpoint
405 Method Not Allowed Wrong HTTP method used Using GET instead of POST
408 Request Timeout Request took too long Slow network or backend delay
429 Too Many Requests Rate limit exceeded Too many API calls
500 Internal Server Error Backend/server issue Application crash or server-side failure
502 Bad Gateway Invalid upstream response Proxy/load balancer/backend issue
503 Service Unavailable Service temporarily unavailable Maintenance or overloaded server

Quick API Troubleshooting Flow

Step 1 — Identify the Error Code

Always start with:

Example:

HTTP/1.1 401 Unauthorized

Step 2 — Validate Authentication

Most API issues are:

authentication-related

Check:


401 Unauthorized

Meaning

Authentication failed.

Common Causes

Example

Authorization: Bearer invalid_token

Troubleshooting


403 Forbidden

Meaning

Authenticated BUT not authorized.

Common Causes

Troubleshooting


400 Bad Request

Meaning

API request invalid.

Common Causes

Example Bad JSON

{
"name": "Cesar"
"role": "admin"
}

Missing comma causes failure.

Troubleshooting


404 Not Found

Meaning

Endpoint/resource does not exist.

Common Causes

Troubleshooting


405 Method Not Allowed

Meaning

Wrong HTTP method used.

Example

Using:

GET /api/create-user

when API expects:

POST /api/create-user

Troubleshooting


429 Too Many Requests

Meaning

API rate limit exceeded.

Common Causes

Troubleshooting


500 Internal Server Error

Meaning

Backend application/server failed.

Common Causes

Troubleshooting


502 Bad Gateway

Meaning

Gateway/proxy received invalid response.

Common Causes

Troubleshooting


503 Service Unavailable

Meaning

Service temporarily unavailable.

Common Causes

Troubleshooting


Structured Troubleshooting Methodology

1. Reproduce the Issue

Questions:


2. Validate Authentication

Check:


3. Validate Request

Check:


4. Review Response Codes

Use HTTP response code to isolate:


5. Review Logs

Look for:


6. Validate Connectivity

Check:


7. Escalate Properly

Gather:

before escalating.


Good Interview Answer

“How do you troubleshoot API issues?”

“I typically start by identifying the HTTP response code and validating whether the issue is related to authentication, request formatting, permissions, networking, or backend failures. I review request headers, payloads, logs, connectivity, and timestamps to isolate the issue before escalating if necessary.”


Common Interview Tip

NEVER immediately blame the backend.

Good engineers:

That’s what interviewers want to hear.


Revision #1
Created 21 May 2026 00:40:31 by Cesar Gzz
Updated 21 May 2026 00:45:22 by Cesar Gzz