Scraping more than one page? Send the URLs as a
batch to one browser instead of starting a browser per page.
Prerequisites
Set your API token and base URL. The examples start a browser with an empty request body, which uses your account’s default proxy pool. Proxy, fingerprint, and other start options are in the API reference.Run an example
The examples use a one-time profile. To reuse a saved login, pass a persistent profile UUID to the session call instead.- curl
- Python (async)
- JavaScript
200 followed by HTML containing Example Domain. The curl example returns the JSON response described below.
Click, type, and scroll
For a specific input sequence, useclient.browser() instead of the client.session() and profiles.scrape() workflow. Its input methods call Surfsky’s Human.* primitives. After creating a client, run this on your target form, replacing the URL and selector:
Request parameters
POST /profiles/{internal_uuid}/scrape accepts:
wait_for with a selector for the content you need is more reliable than networkidle, which can time out on pages with background traffic.
The gateway gives each /scrape call 120 seconds in total, covering every page in a batch. timeout and wait apply inside that budget.
Read the response
success reports whether the Surfsky request succeeded. data.status is the target site’s HTTP status, so a 200 from Surfsky can carry a 403 or a challenge page from the site. Check the target status and content. screenshot is present only when requested; decode it with Base64 to get a PNG.
Scrape several pages
Whenever your job allows it, send several URLs to one browser instead of starting a browser per page. Each start costs time and a browser slot, and the pages in a batch share the same cookies. Send them as an array of request objects to the same endpoint:data comes back as an array in that order; failed items carry error and status_code instead of a page. Keep a batch within the 120-second limit, and use several browsers when you need pages fetched in parallel.
Stop the session
The SDK stops the session when its scope exits, including on errors. For direct HTTP requests, stop the browser with theinternal_uuid from the start response: