EDT
Everyday Dev Tools
Fast tools, no fuss
Home / Tutorials / API Debugging Workflow: A Systematic Step-by-Step Guide
API

API Debugging Workflow: A Systematic Step-by-Step Guide

2026-06-20 · 19 min read

A battle-tested approach to debugging API issues: status codes, payloads, headers, authentication, and common pitfalls from years of troubleshooting.

Introduction: My Approach to API Debugging

I can't tell you how many APIs I've debugged over the years — from my own small projects to large enterprise systems. API issues are some of the most frustrating to debug because there are so many places things can go wrong.

Here's what I've learned: you need a systematic approach. Don't just guess and randomly change things — work through a checklist, eliminate possibilities one by one, and you'll find the problem faster.

In this guide, I'll walk you through the exact workflow I use every time an API isn't working. I've used this to solve everything from simple typos to complex network issues and subtle authentication bugs.

The key principle: start with the easiest things to check first. Status codes, then URLs, then headers, then payloads — get the simple stuff out of the way before diving into the hard stuff.

Step 1: Start with the Status Code

The HTTP status code is your first clue — it tells you immediately what category of problem you're dealing with. Always check the status code before anything else.

**Let's break down what each status range means:**

**2xx: Success**

- 200 OK: The request worked — this is what you want!

- 201 Created: A resource was successfully created (common for POST)

- 204 No Content: Success with no response body (common for DELETE)

If you're getting a 2xx status but something still seems wrong, it's probably a logic issue in your code, not an API issue.

**3xx: Redirection**

- 301 Moved Permanently: The URL changed forever — update your code!

- 302 Found: Temporary redirect — check if you're using the wrong URL

- 304 Not Modified: Cached response is still valid (not an error)

3xx status codes aren't errors, but they can cause unexpected behavior. If you're getting 301 or 302, make sure you're using the canonical URL from the API docs.

**4xx: Client Error — You Did Something Wrong**

- 400 Bad Request: Invalid input — check your payload!

- 401 Unauthorized: Missing or invalid authentication — check your API key/token!

- 403 Forbidden: You're authenticated but don't have permission to do this

- 404 Not Found: The URL doesn't exist — check for typos!

- 422 Unprocessable Entity: Valid syntax but invalid data (common in validation errors)

- 429 Too Many Requests: You're being rate-limited — slow down!

4xx errors are almost always your problem. The good news is that means you can fix them!

**5xx: Server Error — They Did Something Wrong**

- 500 Internal Server Error: Generic server error — their problem, not yours (but your code might have triggered it)

- 503 Service Unavailable: The server is down or overloaded — check their status page

5xx errors are usually temporary, but if you can trigger one consistently with a specific payload, you might want to report it to the API maintainers.

**Pro tip:** Bookmark our HTTP Status Checker to look up status codes quickly — it has explanations for every common status code.

Step 2: Verify the URL and HTTP Method

After the status code, this is the next easiest thing to get wrong — and I've gotten it wrong dozens of times.

**Check these things in order:**

**1. Is the HTTP method correct?**

- GET when it should be POST? PUT when it should be PATCH? DELETE when it should be POST? This is surprisingly common.

- Check the documentation: "Wait, is this endpoint POST or PUT?"

**2. Is the base URL correct?**

- Staging vs production: `https://api.staging.example.com` vs `https://api.example.com`

- Did you copy the wrong environment URL?

- Is it HTTP or HTTPS? Modern APIs almost always require HTTPS.

**3. Is the path correct?**

- Check for typos: `/users` vs `/user`, `/api/v1` vs `/api/v2`

- Trailing slash issues: `/users/` vs `/users` — some APIs care, some don't

- Missing or extra parts: `/api/v1/users/123` vs `/api/v1/123/users`

**4. Are the query parameters correctly formatted?**

- Are parameters properly URL-encoded? Use our URL Encode tool if you're not sure.

- Is `?` before the first parameter and `&` between parameters?

- A common mistake: `?param1=val1?param2=val2` (second `?` should be `&`)

**Real-world story:** I once spent an hour debugging why an API wasn't working — I had `https://api.example.com/v1/users` instead of `https://api.example.com/v2/users`. I had copied an old URL from my notes. Compare your request URL with the documentation character by character — every single one!

Step 3: Inspect the Request Headers

Headers are small, but they can break everything. Here are the most important ones to check:

**Content-Type**

- For JSON payloads: Should be `application/json`

- For form data: Should be `application/x-www-form-urlencoded` or `multipart/form-data`

- Missing or wrong Content-Type is a common cause of 400 errors

**Authorization**

- For bearer tokens: Should look like `Bearer YOUR_TOKEN_HERE`

- Common mistakes: Missing the "Bearer " prefix, typos in "Bearer", extra spaces, missing or extra characters in the token

- API keys might be in `Authorization: ApiKey YOUR_KEY` or a custom header like `X-Api-Key`

**Accept**

- What format you expect back: `application/json` is common

- Some APIs require this to be set correctly

**Other headers to check:**

- `User-Agent`: Some APIs reject requests without a user agent (browsers set this automatically, but manual requests might not)

- `X-Requested-With`: Sometimes required for AJAX requests

- Custom headers specific to the API: Check the documentation!

**Pro tip:** In Chrome DevTools, you can see all request and response headers in the Network tab. In curl, use `-v` to see verbose output including headers. Always check both the request headers you're sending AND the response headers coming back.

Step 4: Validate the Request Body

If you're sending JSON (and these days, you probably are), this is where a lot of problems happen.

**Checklist for JSON payloads:**

**1. Is it valid JSON?**

- No trailing commas after the last property or array item (this is the #1 JSON mistake!)

- All keys in double quotes (not single quotes, not unquoted)

- No comments (JSON doesn't support them!)

- Correctly escaped characters: quotes, backslashes, newlines, etc.

- Use our JSON Validator to check — it will point you right at the error!

**2. Does it match the schema the API expects?**

- Are all required fields present? Check the documentation!

- Are optional fields you're omitting actually optional?

- Are field names spelled correctly and in the right case? `userName` vs `username` vs `user_name` — case matters!

**3. Are the data types correct?**

- This is a big one! Numbers vs strings: `{"id": 123}` vs `{"id": "123"}`

- Booleans are actual booleans, not strings: `{"active": true}` not `{"active": "true"}`

- Dates are in the expected format (usually ISO 8601: `2026-06-20T14:30:00Z`)

- Nested objects have the correct structure

**4. Is anything extra included that shouldn't be?**

- Some APIs reject requests with extra fields

- Make sure you're not sending extra properties from your frontend that the API doesn't expect

**A common mistake:** Sending `{id: "123"}` when the API expects `{id: 123}` (string instead of number). The server might give you a 400 error with a message like "id must be a number", or it might silently accept it and cause strange behavior later.

Step 5: Read the Error Response Carefully

Good error messages are a gift. Unfortunately, not all APIs have them. But whenever an error response comes back, I always read it carefully — it usually tells me exactly what's wrong.

**What to look for in error responses:**

- A specific error message, not just "Bad Request"

- A list of validation errors with field names and issues

- An error code that you can look up in the documentation

- A hint about what to do next

**An example of a good error response:**

{
  "error": "Validation failed",
  "code": "validation_error",
  "details": [
    {
      "field": "email",
      "message": "This field is required"
    },
    {
      "field": "password",
      "message": "Must be at least 8 characters long"
    }
  ]
}

This tells you exactly what's wrong! Fix those two fields and resend.

**An example of a less helpful error response:**

{
  "error": "Something went wrong"
}

If you get something like this, you'll have to do more detective work — check other parts of the response, look at the status code, compare with known-good requests.

**Pro tip:** Always format the error response with our JSON Formatter before reading — it makes the structure much clearer!

Step 6: Compare with a Known-Working Request

If you have something that works (a curl command from the docs, a Postman request, a previous version of your code), compare side-by-side with what isn't working.

**How to do this effectively:**

1. Get the working request in the same format as the non-working one (e.g., both as curl commands, both in DevTools)

2. Compare them line by line, character by character

3. Look for differences in URL, method, headers, and body

4. Try changing one thing at a time in the non-working request to match the working one

**Our JSON Compare tool is perfect for this!** Paste the working payload and the non-working payload side by side, and it will show you exactly what's different — even subtle type changes or field name differences.

**Real-world story:** I once had a request that was failing, and I couldn't figure out why. I had a working curl command from the documentation, and my code wasn't working. When I compared them, I noticed the curl had `{"user": {"name": "John"}}` and my code was sending `{"name": "John"}` — I was missing the wrapping `user` object! I had misread the documentation. Comparing with a known-good request made it obvious immediately.

Step 7: Check the "It Works in Postman but Not in My Code" Scenario

This is such a common situation that it deserves its own section. If it works in Postman (or curl, or another tool) but not in your code, here's what to check:

**1. Are you including all the same headers?**

- Postman might be setting some headers automatically that you're missing in your code (like User-Agent, Accept, etc.)

- Use the "Code" feature in Postman to export the request as curl, then compare with what your code is sending

**2. Is the payload exactly the same?**

- Use our JSON Compare tool to check — even tiny differences matter

- Check for accidental trailing commas or extra whitespace

**3. Are URL parameters correctly encoded?**

- Postman handles encoding automatically, but you might be missing it in your code

**4. Is authentication working the same way?**

- Tokens can expire — are you using a fresh one?

- Is the token format correct (including "Bearer " prefix)?

**5. Is your code doing something extra like following redirects automatically?**

- Sometimes APIs expect you to handle redirects manually

**How to debug this:** Export the working request as a curl command (Postman can do this), then modify your code to send exactly the same request — same URL, same method, same headers, same body. Get that working first, then make changes from there.

My Complete API Debugging Checklist

This is the exact checklist I use every time I debug an API issue. I go through it step by step, and it rarely fails me:

1. **Status Code Check**: What status code came back? What category is it in (2xx, 3xx, 4xx, 5xx)?

2. **URL and Method Check**: Is the URL correct? Right environment? Right path? Right HTTP method (GET, POST, PUT, DELETE, PATCH)?

3. **Header Check**: Are Content-Type and Authorization set correctly? Missing any required headers?

4. **Payload Check**: Is the request body valid JSON? Does it match the schema? Right data types? Use our JSON Validator!

5. **Error Message Check**: Is there an error response? Does it give a specific hint about what's wrong? Format it with our JSON Formatter!

6. **Known-Good Comparison**: Can you compare with a working request from Postman/curl/docs? Use our JSON Compare to find differences!

7. **Authentication Check**: Is your API key/token valid? Not expired? Correct format with proper prefix?

8. **Environment Check**: Are you using the right environment (staging vs production)? Are you using the right keys for that environment?

9. **Rate Limits Check**: Are you being rate-limited (429 status)? Did you get a Retry-After header?

10. **Server Logs Check**: If you have access to the server logs, look for errors there. They often have more detail than what's sent to the client.

11. **Network Check**: Can you reach the server at all? Is your internet working? Is a firewall or proxy blocking the request?

12. **Try Again**: Is it a temporary issue? Sometimes APIs have intermittent problems — try the same request again.

**One last piece of advice:** If you've gone through the whole checklist and still can't find the problem, take a break. Step away for 10 minutes, get some water, come back with fresh eyes. I can't tell you how many times I've found the obvious mistake after taking a break.

Tools That Make This Easier

I couldn't do this job without good tools. Here are the ones I use every day:

**For debugging requests:**

- **Browser DevTools**: The Network tab shows you everything — requests, responses, headers, timing. Essential!

- **curl**: Great for reproducing issues. Use `-v` for verbose output to see headers.

- **Postman/Insomnia**: Great for testing APIs and saving example requests.

- **Our HTTP Status Checker**: Look up what status codes mean quickly.

**For working with JSON:**

- **Our JSON Formatter**: Makes unreadable JSON human-readable.

- **Our JSON Validator**: Finds syntax errors in your JSON.

- **Our JSON Compare**: Finds differences between two payloads.

**For authentication issues:**

- **Our JWT Decoder**: Inspect JWT tokens to check if they're valid and what claims they have.

- **Our Base64 Decoder**: Decode any base64-encoded parts of the auth flow.

The key is to have these tools ready to go before you need them. Don't spend time searching for a JSON formatter when you're in the middle of debugging — bookmark our tools now!

Tools

Try These Tools

Open the tools that go with this tutorial and practice what you learned.

Navigation

Keep Learning