← TemplatesRequest API template

Scrape a JavaScript-heavy page

Extract clean markdown from a client-rendered page with one Request API call — no browser orchestration code.

Request APIScrapingMarkdown

Use this when a plain HTTP client returns an empty shell because the page builds its content in JavaScript. The Request API renders the page in a real stealth browser and returns the finished content as markdown, so your pipeline never sees a loading spinner.

Executable starters

scrape-page.ts
const apiKey = process.env.BROWSERCITY_API_KEY;if (!apiKey) {  throw new Error('Set BROWSERCITY_API_KEY before running this script.');}const response = await fetch('https://api.browser.city/v1/requests', {  method: 'POST',  headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },  body: JSON.stringify({ url: 'https://example.com/product/123', markdown: true }),});if (!response.ok) {  throw new Error(`Request failed: ${response.status} ${await response.text()}`);}const page = await response.json();console.log(page.content);

Production hardening checklist

  • Store the markdown result immediately; re-fetching costs another render.
  • Treat non-2xx responses as retryable with backoff rather than failing the whole batch.
  • Move to POST /v1/requests/batch once you process URL lists instead of single pages.
  • Respect target sites’ terms and rate expectations; extraction speed is rarely the bottleneck, blocks are.

Cost and plan notes

One extraction is one short browser render plus the page’s traffic. Heavy product pages with large media weigh more than text articles, so measure a small sample first and put the real average into /pricing-calculator.

[ 08 / 08 ] — Get Started

Give your AI agents the web.

We're in private beta — request access and we'll get you set up. Private sessions by default.