# Browser Network & HAR Inspector | XHR, Fetch, API Traffic (`produkdigitalali/browser-network-har-capture-inspector`) Actor

Capture real browser network traffic, inspect XHR, Fetch and API calls, detect failures and redirects, and export HAR 1.2 files from public webpages.

- **URL**: https://apify.com/produkdigitalali/browser-network-har-capture-inspector.md
- **Developed by:** [ProdukDigitalAli](https://apify.com/produkdigitalali) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 page captures

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Browser Network & HAR Capture Inspector

Capture real Chromium network traffic from public webpages, export a **HAR 1.2** file for every captured page, and get a compact diagnostic summary of XHR/fetch/API calls, redirects, failures, HTTP errors, slow resources, third-party domains, and transfer size.

This Actor is for developers who need a network diagnostic outcome, not a low-level CDP command runner or a broad endpoint-probing crawler.

### Quick start

```json
{
  "startUrls": [{ "url": "https://example.com" }],
  "captureDurationMs": 1500,
  "includeDetailedRows": false,
  "captureResponseBodies": false,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

The default dataset receives one `summary` row per page. The HAR file is stored in the default key-value store under a key such as `har-001-example.com.har`.

### Capture XHR/fetch only

```json
{
  "startUrls": [{ "url": "https://googlechrome.github.io/samples/fetch-api/fetch-html.html" }],
  "captureDurationMs": 3000,
  "resourceTypes": ["xhr", "fetch"],
  "includeDetailedRows": true
}
```

### What it returns

A page summary contains fields such as:

```json
{
  "rowType": "summary",
  "passed": true,
  "inputUrl": "https://example.com/",
  "finalUrl": "https://example.com/",
  "requestCount": 7,
  "capturedRequestCount": 7,
  "xhrFetchCount": 2,
  "httpErrorCount": 0,
  "failedRequestCount": 0,
  "redirectCount": 1,
  "slowRequestCount": 1,
  "totalTransferBytes": 82431,
  "harKey": "har-001-example.com.har",
  "harUrl": "https://api.apify.com/v2/key-value-stores/.../records/har-001-example.com.har",
  "apiEndpoints": ["https://example.com/api/data"],
  "warnings": []
}
```

When `includeDetailedRows` is enabled, each captured request can additionally produce a compact `network` row with method, URL, resource type, status, initiator type when available, duration, transfer size, redirect/failure flags, and XHR/fetch/GraphQL/WebSocket classification.

### HAR behavior

- HAR version: **1.2**.
- One HAR artifact per processed page/session.
- Common auth, cookie, proxy-auth, and API-key headers are replaced with `[REDACTED]`.
- Credential-like query parameter values are redacted in exported URLs/query strings.
- Response bodies are **OFF by default**.
- If body capture is explicitly enabled, only bounded textual bodies are embedded.
- `maxHarBytes` removes optional bodies first and then truncates recorded entries if required to keep the artifact within the configured limit.

### Useful inputs

| Input | Purpose | Default |
|---|---|---:|
| `startUrls` | Public webpages to capture | required |
| `waitUntil` | Navigation completion condition | `domcontentloaded` |
| `captureDurationMs` | Extra time for late XHR/fetch | `1500` |
| `includePatterns` / `excludePatterns` | Glob filters for recorded requests | empty |
| `resourceTypes` | Optional resource-type filter | all |
| `includeDetailedRows` | Push one dataset row per request | `false` |
| `captureResponseBodies` | Embed bounded textual bodies in HAR | `false` |
| `maxResponseBodyBytes` | Per-response body cap | `262144` |
| `maxRequestsPerPage` | Recorded request cap | `500` |
| `maxHarBytes` | HAR artifact cap | `8388608` |
| `maxPages` | Page/session cap | up to 10 by default |
| `slowThresholdMs` | Slow-resource threshold | `1000` |
| `proxyConfiguration` | Apify/custom proxy | no proxy |

### When to use this Actor

- Export a HAR from a public JavaScript application without opening DevTools manually.
- Discover the XHR/fetch/API traffic a page generates at runtime.
- Find 4xx/5xx or failed browser requests.
- Identify third-party domains contacted by a landing page.
- Compare top slowest or largest resources.
- Run scheduled network diagnostics and save a HAR artifact for each run.

### Safety and privacy

This Actor only supports public HTTP(S) destinations. It rejects localhost, loopback, RFC1918/private, link-local, metadata, multicast/reserved addresses, credential-bearing URLs, and non-web protocols. Browser redirects and subresources pass through the same validating egress proxy.

Authorization, Cookie, Set-Cookie, proxy credentials, and common API-key headers are redacted by default. Response bodies remain off unless you deliberately enable them. Do not put credentials or secrets into public task examples, README snippets, support tickets, or screenshots.

Blocked sites, 403/429 responses, robots/terms restrictions, CAPTCHAs, and access controls are target-specific limitations. This Actor is not positioned as a bypass tool.

### Pricing

Launch pricing uses **Pay Per Event**:

- `page-capture`: **$0.02 for each successful page/session capture**
- standard `apify-actor-start` synthetic event remains at the platform-recommended default

Examples before the Actor-start event:

- 1 successful page capture: **$0.02**
- 5 successful page captures: **$0.10**
- 10 successful page captures: **$0.20**

Security-blocked/preflight-rejected pages are not charged as successful captures. Use Apify's **Maximum cost per run** to bound PPE spend.

### Which ProdukDigitalAli browser tool should I choose?

| Tool | Choose it when... |
|---|---|
| Puppeteer Browser Automation Runner | You want simple Chrome/Puppeteer-style deterministic workflows. |
| Selenium Browser Automation Runner | You think in WebDriver locators or maintain Selenium knowledge. |
| Chrome DevTools Automation Runner | You need low-level CDP commands, emulation, rendering, or diagnostics. |
| Playwright Browser Automation Runner | You want deterministic JSON navigation/click/form/extraction/assertion workflows. |
| **Browser Network & HAR Capture Inspector** | You need HAR export, XHR/fetch/API visibility, failed requests, timing, and third-party domains. |

### Limits

- Chromium only in the MVP.
- Up to 20 input URLs, with bounded `maxPages`.
- Detailed request rows are opt-in to keep dataset size and cost predictable.
- WebSocket support is diagnostic/count-oriented in the MVP; this is not a packet/frame recorder.
- GraphQL classification is heuristic (URL/operation indicators), not schema introspection.

### Support

When reporting an issue, include the Actor run ID, sanitized input, target URL if it is public, and the relevant `errorCode`. Never post API keys, cookies, bearer tokens, passwords, proxy credentials, or private HAR files containing sensitive data.

# Actor input Schema

## `startUrls` (type: `array`):

Public HTTP(S) pages to capture. Private, loopback, link-local, metadata, reserved, and credential-bearing destinations are rejected.

## `waitUntil` (type: `string`):

When initial navigation is considered complete before the optional capture delay.

## `captureDurationMs` (type: `integer`):

Additional milliseconds to keep the page open so late XHR/fetch activity can be observed.

## `includePatterns` (type: `array`):

Optional glob patterns for recorded requests, for example *api* or https://api.example.com/\*. Browser loading is not blocked by this filter.

## `excludePatterns` (type: `array`):

Optional glob patterns excluded from HAR/detail recording.

## `resourceTypes` (type: `array`):

Optional resource-type filter. Leave empty to capture all supported browser requests.

## `includeDetailedRows` (type: `boolean`):

When enabled, push one dataset row per captured network request in addition to the page summary. Disabled by default to keep datasets compact.

## `captureResponseBodies` (type: `boolean`):

OFF by default. When enabled, only bounded textual response bodies are embedded in the HAR. Secret headers remain redacted.

## `maxResponseBodyBytes` (type: `integer`):

Per-response upper bound for optional textual body capture.

## `maxRequestsPerPage` (type: `integer`):

Caps how many requests are recorded into HAR/detail rows. Additional browser traffic may continue but is not recorded.

## `maxHarBytes` (type: `integer`):

HAR artifacts are size-bounded. Optional bodies are removed first, then entries are truncated if necessary.

## `maxPages` (type: `integer`):

Maximum number of start URLs processed in this run.

## `slowThresholdMs` (type: `integer`):

Requests at or above this duration are classified as slow in the summary.

## `navigationTimeoutMs` (type: `integer`):

Maximum time for initial page navigation in milliseconds.

## `maxRunSeconds` (type: `integer`):

Overall run budget in seconds, excluding a small amount of Actor startup/shutdown overhead.

## `proxyConfiguration` (type: `object`):

Optional Apify Proxy or custom HTTP(S) proxy. The Actor keeps its own public-destination guard in front of the upstream proxy.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com"
    }
  ],
  "waitUntil": "domcontentloaded",
  "captureDurationMs": 1500,
  "includeDetailedRows": false,
  "captureResponseBodies": false,
  "maxResponseBodyBytes": 262144,
  "maxRequestsPerPage": 500,
  "maxHarBytes": 8388608,
  "maxPages": 10,
  "slowThresholdMs": 1000,
  "navigationTimeoutMs": 30000,
  "maxRunSeconds": 180,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Page summaries and optional detailed network request rows.

## `harFiles` (type: `string`):

HAR 1.2 artifacts with secret headers redacted.

## `runSummary` (type: `string`):

Compact run-level summary across all captured pages.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://example.com"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("produkdigitalali/browser-network-har-capture-inspector").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startUrls": [{ "url": "https://example.com" }],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("produkdigitalali/browser-network-har-capture-inspector").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://example.com"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call produkdigitalali/browser-network-har-capture-inspector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,produkdigitalali/browser-network-har-capture-inspector"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/iYylSxVdVX7rPhNGR/builds/RRXNiuDI5bi22DZbQ/openapi.json
