Title: Discover a page's underlying JSON API Upstream: POST /webhook/scrape-wp with capture_network: true, up to several attempts

Loads a page in a real browser and reports the XHR and fetch endpoints it calls as a compact index: URL, method, status, timing, the custom request headers the page's own code attached, and a short body preview. The bodies themselves are not returned.

The point of this tool is to end the need for browser mode. Once it reveals the JSON endpoint, call that URL directly with scrape_unblocker in http mode and never render the page again. Measured on a public target, the direct call was 11.8x cheaper than rendering (0.66 s and 2,860 bytes against 7.82 s and 5,880 bytes).

Parameters

  • apiKey (string, required).
  • url (string, required) — the single URL to load and observe.
  • url_filter (string) — regular expression; only matching request URLs are kept. Evaluated by the Go engine (RE2): no backreferences or lookaround. Omit to see every XHR and fetch call.
  • wait_seconds (number, default 3) — extra seconds to keep observing after the page settles.
  • max_captured (number, default 30) — maximum responses to keep. Raise only if network_dropped is non-zero.
  • max_body_bytes (integer, default 4096, minimum 256, backend cap 262144) — bytes of each body the backend keeps. Raise when read_captured_response reports truncated: true.
  • preview_chars (number, default 200) — characters of each body shown as a preview.
  • actions (Action array) — interactions performed before the network is read: scroll to load a list, click a "Reviews" tab, fill_form to run a search.
  • attempts (integer, default 3, range 1–6) — how many times to load the page before giving up on finding a match. Attempts stop as soon as something matches.
  • use_proxy (boolean, engine default true) — route the load through a proxy.
  • headers (object or string) — extra headers sent to the target site, for endpoints that only fire for an authenticated or specially identified visitor.

What is fixed and why

These are set by the tool and not exposed, because they are what keeps a capture from flooding the agent's context or leaking credentials:

  • mode: "browser" and wait_until: "networkidle".
  • resource_types: ["xhr", "fetch"].
  • max_total_bytes: 131072.
  • include_auth_headers: false — Cookie, Authorization, X-API-Key and similar arrive as <redacted>.
  • company_name: "jetscrape-mcp-discovery" — every discovery call is filed under one company instead of leaking a new one per look.
  • An adaptive settle window: at least 8 s, ends after 2 s with no matching request, never longer than 30 s. Only matching requests reset the quiet timer, so analytics beacons and websockets cannot hold it open.
  • A single throwaway selector (title) to satisfy the engine's non-empty selectors rule; its result is discarded.

Example

{
  "name": "discover_api_endpoints",
  "arguments": {
    "apiKey": "js_YOUR_API_KEY",
    "url": "https://shop.example.com/p/866178029/reviews",
    "url_filter": "review",
    "wait_seconds": 3
  }
}
{
  "dispatch_id": "disp_9f3a",
  "attempts": [
    { "attempt": 1, "captured": 2, "total_responses": 41 }
  ],
  "captured": 2,
  "network_dropped": 0,
  "settle": {
    "observed_ms": 9820,
    "first_match_ms": 5330,
    "last_match_ms": 7810,
    "ended_by": "quiet",
    "total_responses": 41
  },
  "endpoints": [
    {
      "i": 0,
      "started_ms": 5330,
      "method": "GET",
      "status": 200,
      "resource_type": "xhr",
      "url": "https://apigw.example.com/review-read/reviews?productId=866178029&page=1",
      "body_bytes": 4096,
      "truncated": true,
      "preview": "{\"content\":[{\"userFullName\":\"J** D**\",\"rate\":4,",
      "custom_request_headers": { "X-Page-Number": "1", "X-Storefront": "web" }
    },
    {
      "i": 1,
      "started_ms": 7810,
      "method": "POST",
      "status": 200,
      "resource_type": "fetch",
      "url": "https://apigw.example.com/graphql",
      "body_bytes": 1932,
      "truncated": false,
      "preview": "{\"data\":{\"reviewSummary\":{\"average\":4.3,",
      "custom_request_headers": { "Authorization": "<redacted>" },
      "request_body_bytes": 412
    }
  ],
  "hint": "Pick the endpoint that holds your data and call it directly with scrape_unblocker(mode: 'http') …"
}

Reading the result

  • dispatch_id — needed by read_captured_response.
  • attempts[] — what each page load saw. total_responses near zero means the page barely loaded at all.
  • captured and network_dropped — index size and how many responses a limit discarded.
  • settle — what the observation window did. ended_by: "quiet" means you watched long enough; "cap" or "floor" means the window may have been cut short.
  • endpoints[] — sorted by started_ms; i is the index to pass on.
  • custom_request_headers — headers the page's own code attached; browser boilerplate is filtered out. When the same URL appears with different content, the differing header (a page number, a variant id, a locale) is what selects it. A <redacted> value means the call carried a credential.
  • request_body_bytes — present only when the request had a body; non-zero means a POST or GraphQL call whose request_body you will need to replay it.
  • hint — the next step, including what to try when the list is empty.

Then replay the endpoint

{
  "name": "scrape_unblocker",
  "arguments": {
    "apiKey": "js_YOUR_API_KEY",
    "url": "https://apigw.example.com/review-read/reviews?productId=866178029&page=2",
    "mode": "http",
    "selectors": [
      { "property_name": "author[]", "selector": "content.userFullName", "attribute_type": "JSON" },
      { "property_name": "rate[]", "selector": "content.rate", "attribute_type": "JSON" },
      { "property_name": "comment[]", "selector": "content.comment", "attribute_type": "JSON" }
    ],
    "options": {
      "company_name": "shop-example-reviews",
      "headers": { "X-Page-Number": "2", "X-Storefront": "web" }
    }
  }
}

Selectors against JSON use attribute_type: "JSON" and a dotted path, not CSS. A CSS selector against a JSON body matches nothing, silently.

When nothing matches

An empty endpoints list is not an error, and one page load is not evidence. Measured on a retail site, eight identical calls found the product endpoint in three of them, because the page only fires its data calls for some exit addresses. Try, in order:

  1. Read settle.ended_by and total_responses. A short window or a page that loaded almost nothing means the app never booted, usually a proxy draw. Flip use_proxy.
  2. Widen or drop url_filter.
  3. Raise wait_seconds if started_ms values suggest the endpoint fires late.
  4. Pass actions to trigger the call yourself.
  5. Pass headers if the endpoint only fires for an authenticated visitor.
  6. Point the tool at a page dedicated to the data, such as a standalone reviews URL.
  7. If the page truly renders server-side, the data is in the HTML: use get_html or scrape_unblocker in http mode with selectors.

Read one full body with read_captured_response before writing paths, so you work against the real shape of the response rather than a 200-character preview.

Last updated: September 22, 2026