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.

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

How to Use the SDK

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 example

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 example

Attach Playwright (or Puppeteer) 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'

// Ensure the profile's browser is running
await client.profile.launch(profileId)

// Controller bound to that profile
const browser = new IncognitonBrowser({
profileId,
headless: true,
})

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

const page = await pwBrowser.newPage()
await page.goto('https://example.com')
await page.screenshot({ path: 'example.png' })

// Clean shutdown (frees resources)
await browser.close(pwBrowser)

// Optionally stop the profile/browser
await client.profile.stop(profileId)

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 Overview

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.switch_proxyUpdate a profile’s proxy settings.
client.profile.launchLaunch the profile locally (starts the browser).
client.profile.launch_force_localLaunch using only local data.
client.profile.launch_force_cloudLaunch with a fresh cloud sync.
client.profile.get_statusCheck current profile status/readiness.
client.profile.stopStop the running profile/browser.
client.profile.force_stopForce 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.launch_puppeteerLaunch for Puppeteer; returns a DevTools URL.
client.automation.launch_puppeteer_customSame, with extra Chromium flags.
client.automation.launch_seleniumLaunch for Selenium; returns a WebDriver URL.
client.automation.launch_selenium_customSame, 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 false).
customArgsExtra Chromium flags (e.g. --no-sandbox).
launchTimeoutMax time to wait for readiness (ms).

Endpoints & Methods:

MethodWhat it does
browser.start_playwrightReturn a connected Playwright Browser (CDP).
browser.start_seleniumReturn a connected Selenium WebDriver.
browser.closeClose a single Playwright browser instance.
browser.close_allClose multiple Playwright instances in parallel.

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?