Before you start
In the Surfsky dashboard:- Copy your API token.
- Pick the region closest to the machine that runs your code and copy the API base URL shown for it.
YOUR_API_TOKEN and https://YOUR_API_HOST below with those values.
SDK quickstart
The SDK is the recommended way to work with Surfsky. It controls the browser directly, without the extra scripts and bindings that Playwright, Puppeteer, and ChromeDriver inject into the page, and it does almost everything you need from an automation library.- Python
- JavaScript / TypeScript
Requires Python 3.12 or newer.Save as Run it:
first_browser.py:Connect your existing code
Follow the guide for your framework:Using the API directly
1. Start a browser
- One-time
- Persistent
Start a browser on a one-time profile. It lives for a single session, and its state is discarded when the browser stops:
2. Connect
Pass the returnedws_url to your framework’s CDP connection method. Use the existing browser context to work with the profile’s state.
The default inactivity timeout is 30 seconds. To allow more time, set inactive_kill_timeout in the start request. For example, "browser_settings": {"inactive_kill_timeout": 300} allows 300 seconds of inactivity.
To interact with the browser through HTTP requests, use the Scraping API with the returned internal_uuid.
3. Stop it
A running browser occupies 1 browser slot until it stops.
- Call a method that closes the remote browser, such as Puppeteer’s
browser.close(). - Leave it idle until
inactive_kill_timeoutexpires. - Send the stop request below.
INTERNAL_UUID with the value from your start response:
If the example fails
See Errors for other API failures. Continue with Sessions to reuse browser state, or the Python and TypeScript SDK guides for browser actions and pooling.