
Debugging Web API Calls with Chrome’s Network Inspector
When a page shows stale data, an error message, or nothing at all, the problem may be in the API call rather than the interface. The Chrome DevTools Network tab lets you see what the browser actually sent and what the server returned. Use it to check request details, response data, timing, and failures—then narrow down where the issue lies.
This guide walks through how to inspect API requests in Chrome, troubleshoot common problems such as CORS errors, and save a HAR file when you need to share or revisit a session.
What the Network Tab Can Tell You
An API connects software that needs to exchange data. If you’re new to the concept, start with this explanation of what an API is. In DevTools, the Network panel shows browser network activity, including API calls made with fetch or XMLHttpRequest.
For each request, you can inspect its URL, method, status code, request headers, payload, response, and timing. That helps answer practical questions: Did the browser send the call? Did it reach the server? Was the response an error, or did the page simply fail to use the returned data?
How to Find and Inspect an API Request
1. Open DevTools and capture a fresh request
- Open the page you’re debugging in Chrome.
- Open DevTools with F12 or Ctrl+Shift+J on Windows/Linux, or Cmd+Option+J on macOS. You can also right-click the page and select Inspect.
- Select the Network tab.
- Enable Preserve log if you need requests to remain visible across navigation or reloads.
- Reload the page or repeat the action that triggers the failing call.
Starting the capture before reproducing the issue matters: DevTools generally shows requests made while it is open. If the list is crowded, select the Fetch/XHR filter to focus on common API calls. You can also use the filter box to search by URL or resource name.
For a broader walkthrough of finding and exploring endpoints, see Exploring API Endpoints with Chrome DevTools.
2. Check status, method, and URL
Select a request to open its details. Start with the Headers panel. Confirm that the request URL points to the expected host and path, and check the method—such as GET, POST, or PUT.
Read the status code, but don’t treat it as the whole diagnosis. A 200 response can contain unexpected data, while a 404 may indicate a wrong route or identifier. A 401 or 403 often points to an authentication or permission issue; a 500 usually indicates a server-side failure. A pending request may be waiting on the server, a connection, or other browser activity.
3. Inspect request headers and payload
Under Headers, review the request headers the browser sent. Check values relevant to the endpoint, such as Authorization, Content-Type, and Accept. Header names are case-insensitive, but the expected values and format still matter. Don’t share screenshots or HAR files containing credentials, cookies, or personal data.
For a call that sends data, open Payload to inspect the request body and query parameters. Compare them with what the API expects. A missing field, unexpected value, or incorrectly formatted JSON can explain why a server rejects a request.
4. Read the response and timing
Open Response or Preview to see what the server returned. Look for an error message, a response with missing fields, or data that differs from what the page displays. If the response looks correct, the issue may be in application code that parses, transforms, or renders it.
Use Timing to see where time was spent, such as waiting for a connection or for the server to respond. Timing details help identify slow requests, though a single capture may not prove the cause. Repeat the test if performance varies.
Debugging Common API Problems
Request missing or sent to the wrong endpoint
If you can’t find the call, clear any text in the filter box, confirm the correct resource filter is selected, and reproduce the action again. Check whether a service worker, page logic, or cache affects the behavior. If the request appears, verify its full URL, query parameters, and method against the API documentation.
Understanding CORS failures
To debug CORS, look for a failed request and any related OPTIONS request. Browsers may send a preflight request before certain cross-origin calls to check whether the server permits the method and headers. In the Console, read the CORS error for clues; in Network, inspect the preflight and actual request when available.
CORS is enforced by the browser. A request may reach the server, yet the browser can block the page from reading the response if the server’s CORS headers are missing or incorrect. Check the server’s Access-Control-Allow-Origin value and, when relevant, its allowed methods and headers. Fix CORS configuration on the server; adding a header in frontend JavaScript cannot override browser enforcement.
Using “Copy as” carefully
Right-click a request to copy it as cURL or another available format. This can help reproduce a request outside the browser, but the copied command may include cookies, tokens, or other secrets. Treat it as sensitive, redact credentials before sharing, and remember that a command-line result may differ from a browser request because browser CORS rules do not apply in the same way.
Preserve HAR Files for Later Analysis
A HAR file records captured network activity and is useful when a teammate or support engineer needs to examine a problem they cannot reproduce immediately.
- Reproduce the issue with DevTools open and the Network tab capturing requests.
- Right-click in the request list and choose the available option to save or export the capture as a HAR file. The exact wording can vary by Chrome version.
- Before sharing it, review the file for authorization headers, cookies, personal information, and sensitive request or response data. Remove or sanitize anything private.
A HAR is a snapshot, not a complete account of the application. It may not include earlier activity if capture began late, and it won’t explain what the frontend did with a response. Keep captures limited to the reproduction you need, and store them securely.
Trade-Offs and Troubleshooting Pitfalls
- Lots of noise: Analytics, images, and background polling can bury the relevant call. Use Fetch/XHR, search filters, and a fresh reproduction.
- Cache changes the result: If you suspect cached data, enable Disable cache while DevTools is open, then reload. This changes test conditions, so compare with normal behavior too.
- Misreading status: A successful HTTP response doesn’t guarantee the UI is correct. Inspect the response body and the code that consumes it.
- Sensitive captures: Request headers and HAR files can expose credentials or user data. Sanitize them before sharing.
- Browser-only behavior: Replaying a request outside Chrome can help isolate server behavior, but it may not reproduce browser security checks such as CORS.
DevTools is focused on inspecting and debugging web pages, not customizing the browser interface. For that separate task, see how to customize Chrome’s New Tab page.
Conclusion
The Chrome DevTools Network tab turns an unclear API failure into evidence you can investigate. Capture the request, verify its URL and method, inspect request headers and payload, then compare the response and timing with what the page displays. For cross-origin failures, examine preflight activity and server CORS headers; when you need help, preserve a HAR carefully and remove sensitive data first. With a repeatable capture and a few focused checks, you can identify whether the trouble lies in the browser, the application, or the API.
