syfin-sdk
v1.1.0
Published
Node.js SDK client for Syfin antidetect browser
Maintainers
Readme
syfin-sdk
Node.js client for the Syfin antidetect browser SDK.
Install
npm install syfin-sdkQuick Start
const Syfin = require('syfin-sdk');
(async () => {
const syfin = new Syfin({ port: 7600 });
await syfin.connect();
// Launch with random device
const browser = await syfin.launch({
startingURL: 'https://example.com',
});
// Full Playwright-style API
await browser.goto('https://example.com/login');
await browser.fill('#email', '[email protected]');
await browser.fill('#password', 'password123');
await browser.click('button[type="submit"]');
await browser.waitForSelector('.dashboard');
const title = await browser.title();
console.log('Page title:', title);
// Save session (all cookies + localStorage from every origin)
const session = await browser.saveSession();
console.log(`Saved ${session.cookies.length} cookies`);
// Save and persist to Syfin's Sessions tab
const saved = await browser.saveSession({
name: 'My Session',
tags: ['nike', 'checkout'],
notes: 'Got past queue',
});
console.log('Session ID:', saved.sessionId);
// Loop: close → rotate proxy → wait 5s → relaunch
const newBrowser = await browser.loop();
console.log('Relaunched with new IP:', newBrowser.id);
// Listen for user closing the browser via the control panel
newBrowser.onClose(() => {
console.log('User closed the browser');
syfin.disconnect();
});
})();Constructor
const syfin = new Syfin({ host: '127.0.0.1', port: 7600 });Client Methods
| Method | Description |
|--------|-------------|
| connect() | Connect to the Syfin SDK server |
| disconnect() | Disconnect |
| launch(opts) | Launch a browser, returns SyfinBrowser |
| getDevices() | List available iPhone device profiles |
| getProxies() | List saved proxies |
| getSessions() | List saved sessions |
launch(opts)
| Param | Type | Description |
|-------|------|-------------|
| startingURL | string | URL to open on launch |
| device | string | Device name (e.g. 'iPhone 16 Pro'), random if omitted |
| proxy | string | ip:port, ip:port:user:pass, or saved proxy name. Append rotateURL: ip:port:https://rotate.url |
| session | string | Session ID or name to restore |
Browser Methods
Navigation
goto(url, options?)— navigate to URLgoBack(options?)/goForward(options?)/reload(options?)url()/title()/content()
Interaction
click(selector, options?)type(selector, text, options?)fill(selector, value)press(selector, key, options?)selectOption(selector, values)setInputFiles(selector, files)
Waiting
waitForSelector(selector, options?)waitForNavigation(options?)waitForTimeout(ms)
Evaluate
evaluate(expression)— run JS in the page
Screenshots
screenshot(options?)— returns a Buffer
Tabs
newTab(url?)/switchTab(index)/closeTab(index)/getTabs()
Cookies
addCookies(cookies)/getCookies(urls?)/clearCookies()
Syfin-Specific
loop()— close → rotate proxy → 5s wait → relaunch. Returns newSyfinBrowsersaveSession(opts?)— capture all cookies + localStorage from every originclose()— close the browseronClose(fn)— listen for user closing via control panel
saveSession(opts?)
Returns session data (cookies, localStorage, proxy, startingURL). Optionally persists to Syfin's Sessions tab.
| Param | Type | Description |
|-------|------|-------------|
| name | string | Session name (providing this also persists to DB) |
| persist | boolean | Force persist to DB even without a name |
| tags | string[] | Tags for the saved session |
| notes | string | Notes for the saved session |
// Just get the data
const data = await browser.saveSession();
// Persist to Sessions tab
const data = await browser.saveSession({
name: 'My Session',
tags: ['nike'],
notes: 'Got past queue',
});
console.log(data.sessionId); // use to restore later with launch({ session: id })