Network Tab for API Calls0%

Network Tab for API Calls

Beginner12 min read•Updated: Jul 11, 2026
Study Materials

Network Tab for API Calls in Modern JavaScript

When frontend JavaScript interacts with backend APIs, debugging HTTP requests and responses is a daily necessity. The Network Tab in browser DevTools provides deep visibility into every network transaction—displaying request headers, payloads, response bodies, timings, status codes, and SSL certificates.


1. Network Tab Overview & Filtering

Open DevTools (F12) and navigate to the Network tab:

Output
┌────────────────────────────────────────────────────────────────────────┐
│ Filter: [ Fetch/XHR ] [ Preserve log ] [ Disable cache ] │
├──────────────┬────────┬────────┬──────┬────────┬────────┬──────────────┤
│ Name │ Status │ Type │ Size │ Time │ Method │ Waterfall │
├──────────────┼────────┼────────┼──────┼────────┼────────┼──────────────┤
│ /api/v1/auth │ 200 OK │ fetch │ 1.2KB│ 145ms │ POST │ █▒▒ │
│ /api/v1/cart │ 304 │ fetch │ 420B │ 45ms │ GET │ █ │
│ /api/v1/pay │ 500 │ fetch │ 2.4KB│ 820ms │ POST │ █████ │
└──────────────┴────────┴────────┴──────┴────────┴────────┴──────────────┘

Essential Settings

  • Fetch/XHR Filter: Click this button to filter out images, CSS, and fonts, showing only JavaScript API calls.
  • Preserve Log: Prevents clearing the network history when a form submits or the page reloads.
  • Disable Cache: Forces the browser to bypass local cache and retrieve fresh assets from the server while DevTools is open.

2. Inspecting Request & Response Details

Clicking any request entry in the table opens the detail drawer with key inspection tabs:

1. Headers Tab

  • General: Request URL, Request Method (GET, POST), Status Code (200, 401, 500), Remote IP Address.
  • Request Headers: Headers sent by the browser (Authorization: Bearer ..., Content-Type: application/json).
  • Response Headers: Headers sent back by the server (set-cookie, access-control-allow-origin, cache-control).

2. Payload Tab (Request Body)

  • Displays the raw or formatted parameters/JSON sent in a POST or PUT request body.

3. Response / Preview Tab

  • Displays the parsed JSON object or text returned by the server. Allows expanding objects and inspecting error details.

3. Debugging Common API Errors

1. CORS Errors (Cross-Origin Resource Sharing)

  • Symptom: Red request in Network tab; console reads No 'Access-Control-Allow-Origin' header is present.
  • Cause: Backend server is hosted on a different origin (domain/port) and did not return proper CORS headers.

2. 401 Unauthorized vs. 403 Forbidden

  • 401 Unauthorized: Missing or expired Authorization token header.
  • 403 Forbidden: Authenticated, but user lacks permission for that resource.

3. 404 Not Found

  • Incorrect API route URL or resource ID.

4. 500 Internal Server Error

  • Unhandled server-side exception. Check the Response tab to read the server's crash log or stack trace.

4. Network Throttling: Simulating Mobile Networks

Modern users frequently browse on slow 3G or 4G connections. DevTools allows you to simulate these environments:

  • Click the Throttling dropdown (defaults to "No throttling").
  • Select Fast 3G, Slow 3G, or Offline.
  • Test whether your loading spinners appear properly and whether your timeout abort controllers function under high latency.

Interactive Quiz

Practice Quiz

Question 1
Which filter in the DevTools Network tab displays only JavaScript API requests (excluding images, CSS, and fonts)?
Question 2
What does enabling the "Preserve Log" checkbox in the Network tab do?
Question 3
Where can you inspect the JSON body sent to the server in a POST request?
Question 4
If a request fails with an HTTP 401 status code, what does this indicate?
Question 5
How can you test how your application behaves on slow mobile internet connections?
Next Lesson

Quiz App

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Breakpoints in DevToolsQuiz App

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

PrevNext