SDKs & reference

Examples

End to end recipes for common jobs: scrape behind a profile, run many accounts in isolation, and replay one routine across a fleet. Each uses the same launch and CDP path as the rest of the API.

Scrape behind a profile

Launch a profile, drive it with Playwright, read the data you need, then stop the profile. The profile carries its own fingerprint and proxy, so the request looks like an ordinary browser on an ordinary device.

import { OculrClient } from "@oculr/sdk";
const oculr = new OculrClient({
baseUrl: "http://127.0.0.1:8378",
token: process.env.OCULR_TOKEN,
});
// Launch the profile and connect a Playwright browser in one call.
const { browser } = await oculr.connect("de-store-01", { stealth: "balanced" });
const page = browser.contexts()[0].pages()[0];
await page.goto("https://example.com/products");
const titles = await page.$eval(".product-title", (els) =>
els.map((el) => el.textContent?.trim()),
);
console.log(titles);
await browser.close();
await oculr.stop("de-store-01");

Run multiple accounts

Each profile is a separate identity with its own fingerprint, storage, and proxy, so accounts stay isolated even when you drive them at the same time. Launch one profile per account and act in each.

import { OculrClient } from "@oculr/sdk";
const oculr = new OculrClient({
baseUrl: "http://127.0.0.1:8378",
token: process.env.OCULR_TOKEN,
});
const accounts = ["acct-paris", "acct-berlin", "acct-madrid"];
await Promise.all(
accounts.map(async (id) => {
const { browser } = await oculr.connect(id, { stealth: "balanced" });
const page = browser.contexts()[0].pages()[0];
await page.goto("https://example.com/account");
// ... act as this account ...
await browser.close();
await oculr.stop(id);
}),
);
Concurrency is bounded by your own CPU, memory, and proxies, not by a per browser hour meter. Scale the list to what your hardware can hold.

Replay one routine across a fleet

Write the steps once as a function, then run them against every profile in a fleet. Each profile gets its own driver session, so the runs are independent.

import { OculrClient } from "@oculr/sdk";
const oculr = new OculrClient({
baseUrl: "http://127.0.0.1:8378",
token: process.env.OCULR_TOKEN,
});
const fleet = ["de-store-01", "de-store-02", "de-store-03"];
// One routine, run against every profile in the fleet.
async function routine(page) {
await page.goto("https://example.com/login");
// ... shared steps ...
}
await Promise.all(
fleet.map(async (id) => {
const { browser } = await oculr.connect(id, { stealth: "max" });
const page = browser.contexts()[0].pages()[0];
await routine(page);
await browser.close();
await oculr.stop(id);
}),
);
To replay a flow without writing the loop, record it once in the app and replay the saved workflow across a fleet. Recorded workflows run without an agent per run. See Built-in agent.