Node.js SDK

The Node.js SDK lets you manage Incogniton profiles, cookies, and run full browser automation from JavaScript/TypeScript by talking to the locally running Incogniton desktop app. Everything stays on your machine—no remote tokens, no cloud roundtrips.

Runnable Node.js examples built on this SDK: incogniton-automation-examples.

Requirements

Before installing and using the Node.js SDK, ensure you have the following in place:

  • Incogniton account — Sign up here if you don’t already have one.
  • Incogniton desktop app — Download the app and ensure it’s open and running on your machine.
  • At least one browser profile created within the Incogniton app.
  • Node.js 16+ installed on your machine.
  • Familiarity with using async/await in JavaScript/TypeScript.

The SDK requires the Incogniton desktop app to be running locally. API calls will not work if the app is closed.

Installation

To get started with the Node.js SDK, you first need to install it. The installation process is straightforward and supports npm, yarn, and pnpm package managers.

Install Node.js SDK

bash
npm install incogniton

Incogniton Client Usage Examples

The Incogniton Node.js SDK provides a simple, fully async API for managing browser profiles and automating browsers. Below are common usage examples to help you get started quickly.

All SDK calls run locally on your machine — No API tokens or extra authentication required.

API Client usage examples (Incogniton Client)

Use the API client for profile lifecycle and cookies. The SDK is fully async—await every operation that hits the app.

API Client Example

ts
import { IncognitonClient } from 'incogniton'

const client = new IncognitonClient()

// Create a profile
const created = await client.profile.add({
  profileData: {
    name: 'My Profile',
    // ...other fields
  },
})

// List profiles
const profiles = await client.profile.list()

// Get a specific profile
const profileId = 'your_profile_id'
const profile = await client.profile.get(profileId)

// Launch (starts a local, profile-bound browser)
await client.profile.launch(profileId)

// Stop when done
await client.profile.stop(profileId)

// ESM assumes "type": "module" — for CommonJS, wrap "await" in an async function.

Browser Automation Usage (Incogniton Browser)

Attach your preferred automation tool (e.g Playwright) to the running, profile-bound browser via CDP. This example shows Playwright, the Puppeteer variant is below.

Browser Automation Example

ts
import { IncognitonClient, IncognitonBrowser } from 'incogniton'

const client = new IncognitonClient()
const profileId = 'your-profile-id'

// Controller bound to that profile. startPlaywright() launches the profile itself:
// do not call client.profile.launch() first (launching an open profile fails).
const browser = new IncognitonBrowser({
profileId,
headless: true,
})

// Establish CDP session → Playwright Browser
const pwBrowser = await browser.startPlaywright()

// Use the profile's persistent default context. pwBrowser.newPage() would create a
// fresh, empty context without the profile's cookies and storage.
const page = await pwBrowser.contexts()[0].newPage()
await page.goto('https://example.com')
await page.screenshot({ path: 'example.png' })
await page.close()

// Graceful stop: lets Chrome flush cookies/storage before the app stops the profile
// (client.profile.stop() terminates the browser process).
const cdp = await pwBrowser.newBrowserCDPSession()
await cdp.send('Browser.close').catch(() => {})
await browser.close(pwBrowser)

Headless mode

When you run automation in headless mode, the browser UI doesn’t open. This reduces resource consumption and speeds up execution, making it ideal for high-volume automation tasks.

Running in Headless Mode

import { IncognitonBrowser } from 'incogniton'

const browser = new IncognitonBrowser({
  profileId: 'your-profile-id',
  headless: true, // Enables headless mode
})

SDK Reference

The SDK is a local-first async client. It sends your commands to the Incogniton app’s Local API, which launches profile-bound browsers for automation. The SDK then connects via CDP or WebDriver so you can control pages using automation tools like Playwright, Puppeteer, or Selenium.

[Your JS/TS Script] ──(async/await)──> [Incogniton SDK]
                                      │
                                      ▼
                           Local API @ http://localhost:35000
                                      │
                         CDP / Web Driver bridge (Playwright/Puppeteer/Selenium)
                                      ▼
                [Profile-Bound Incogniton Browser (Chromium)]

All operations are async. Chain actions with await to keep control flow predictable and to surface errors promptly.


IncognitonClient — Reference

Use Incogniton Client for local API actions: profiles, cookies, and starting automation-ready sessions.

Configuration:

OptionPurpose
baseUrlLocal API address (default http://localhost:35000).
portConvenience override for the local API port.
timeoutRequest timeout for client calls (if supported).

Profile Operations (client.profile) High-level lifecycle and metadata management.

MethodWhat it does
client.profile.listList all browser profiles.
client.profile.getGet a specific profile by ID.
client.profile.addCreate a new profile.
client.profile.updateUpdate an existing profile.
client.profile.switchProxyUpdate a profile’s proxy settings.
client.profile.launchLaunch the profile locally (starts the browser).
client.profile.launchForceLocalLaunch using only local data.
client.profile.launchForceCloudLaunch with a fresh cloud sync.
client.profile.getStatusCheck status. Values are capitalised: Ready, Launched, Syncing, …
client.profile.stopStop the running profile/browser.
client.profile.forceStopForce stop a running profile/browser immediately.
client.profile.deleteDelete a profile.

Cookie Operations (client.cookie) Manage cookies without opening a browser.

MethodWhat it does
client.cookie.getGet all cookies for a profile.
client.cookie.addAdd cookies to a profile.
client.cookie.deleteDelete all cookies for a profile.

Automation Operations (client.automation) Prepare sessions and get connection endpoints.

MethodWhat it does
client.automation.launchPuppeteerLaunch for Puppeteer; returns a DevTools URL.
client.automation.launchPuppeteerCustomSame, with extra Chromium flags (e.g. --headless=new). Check status === 'ok': errors arrive as HTTP 200 {status:'error', message}.
client.automation.launchSeleniumLaunch for Selenium; returns a WebDriver URL.
client.automation.launchSeleniumCustomSame, with custom ChromeOptions/flags.

IncognitonBrowser — Reference

Use Incogniton Browser to attach Playwright/Puppeteer/Selenium to a running, profile-bound browser. Prefer reusing a single controller per worker

Configuration:

OptionPurpose
profileIdWhich Incogniton profile to launch/attach.
headlessRun without a visible window (default true).
customArgsExtra Chromium flags (e.g. --no-sandbox).
launchTimeoutMax time to wait for readiness (ms).

Endpoints & Methods:

MethodWhat it does
browser.startPlaywrightLaunch the profile and return a connected Playwright Browser (CDP). Use browser.contexts()[0] for the profile's persistent context.
browser.startPuppeteerLaunch the profile and return a connected Puppeteer Browser.
browser.closeClose a Playwright/Puppeteer instance. For Playwright this only disconnects; stop the profile afterwards.
browser.closeAllClose multiple instances.

Troubleshooting & FAQs

Yes. You can customize fingerprint settings either in the Incogniton app (edit your profile’s fingerprint settings before launching) or programmatically via the SDK/API. You can set timezone, language, screen resolution, fonts, WebRTC, and more to align with your target environment. See the API Reference at the end of this page for details.

Ensure the Incogniton desktop app is running and you’re logged in. • Check the profile isn’t already open — stop it before relaunching. If stuck syncing, try the “force local” launch option.

Confirm Incogniton is running on the same machine and that your plan includes API access. Default port is 35000 — verify it hasn’t been changed in settings. Check firewall rules to ensure the port isn’t blocked.

Launch a profile via the automation API or SDK, wait until it’s ready, then connect with puppeteer.connect() using the provided DevTools URL. • Install puppeteer-core instead of full Puppeteer. See the Scraping with Incogniton guide for detailed steps.

No. Incogniton bundles its own Chromium build.
• No ChromeDriver or separate browser install is required.


Next Steps:


Need help? Join our community or contact support.


Was this page helpful?