> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Network

> Get the JSON responses a page loaded while it rendered, with their URLs and bodies. Read the data behind a page directly. $1 per 1,000 pages.

`network` returns the JSON responses the page loaded while it rendered. Use it to read the data behind a page that fills itself from an API, without parsing the HTML.

## Make a request

Get an API key in the [Quickstart](https://docs.stophy.dev/quickstart). This request reads a search page that loads its results from an API.

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.npmjs.com/package/zod",
    "formats": ["network"]
  }'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://www.npmjs.com/package/zod",
    formats: ["network"],
  }),
});
const { data } = await response.json();
for (const call of data.network) {
  console.log(call.method, call.status, call.url);
}
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://www.npmjs.com/package/zod",
        "formats": ["network"],
    },
)
data = response.json()["data"]
for call in data["network"]:
    print(call["method"], call["status"], call["url"])
```

## Read the response

`data.network` is an array in the order the responses arrived. This real response is cut to two of its three entries, and each body to its first characters. The full second body was 20,927 characters.

```json theme={null}
{
  "success": true,
  "data": {
    "network": [
      {
        "url": "https://www.npmjs.com/package/zod/v/4.6.7/provenance",
        "method": "GET",
        "status": 200,
        "contentType": "application/json",
        "body": "{\"summary\":{\"subjectAlternativeName\":\"https://github.com/colinhacks/zod/.github/workflows/…"
      },
      {
        "url": "https://api.github.com/repos/colinhacks/zod/pulls?per_page=1",
        "method": "GET",
        "status": 200,
        "contentType": "application/json; charset=utf-8",
        "body": "[{\"url\": \"https://api.github.com/repos/colinhacks/zod/pulls/6768\",\"id\"…"
      }
    ],
    "metadata": {
      "title": "zod - npm",
      "sourceURL": "https://www.npmjs.com/package/zod",
      "statusCode": 200,
      "contentType": "text/html",
      "cacheState": "miss",
      "scrapeId": "615d2f30-f0f3-4f9a-8379-cb72a795738b",
      "costUsd": 0.001
    }
  },
  "id": "615d2f30-f0f3-4f9a-8379-cb72a795738b",
  "costUsd": 0.001,
  "requestId": "615d2f30-f0f3-4f9a-8379-cb72a795738b"
}
```

| Field | What it holds |
| - | - |
| `url` | The URL that was called, with its query string. |
| `method` | `GET`, `POST` and so on. |
| `status` | The status code of the response. |
| `contentType` | The content type of the response. |
| `body` | The response body, as a string. Parse it as JSON. |

## Options

| Field | Type | Default | Effect |
| - | - | - | - |
| `formats` | `array` | `["markdown"]` | Add `"network"` to return the JSON the page loaded. |

Use `waitFor` or [browser actions](https://docs.stophy.dev/scrape/browser-actions.md) when the data loads after a click or a delay.

## Limits and errors

* Only `fetch` and `XMLHttpRequest` responses with a JSON content type are kept. Images, scripts and styles are not.
* At most 30 responses are returned. A body larger than 256 KB is left out, and the bodies together are capped at 2 MB. `data.networkDropped` counts the responses left out. It is left out when no response was dropped.
* A page that loads no JSON returns no entries.
* The page is read in a browser and never from a stored copy.

## Price

\$1 per 1,000 pages, the same as any page. `network` adds nothing.

## Related

* [Browser actions](https://docs.stophy.dev/scrape/browser-actions.md) click and scroll before the page is read.
* [Waiting and rendering](https://docs.stophy.dev/scrape/waiting-and-rendering.md) lets slow requests finish.
* [JSON](https://docs.stophy.dev/scrape/json.md) fills fields from the rendered page.
* [Scrape overview](https://docs.stophy.dev/scrape/overview) lists every format.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.