Browser configuration object

For the full list of available options, view the interactive api documentation

Example usage of the browser configuration in code:

import fetch from "node-fetch";
import { chromium } from "playwright-core";

// Browser configuration settings
const browserConfiguration = {
  session: {
    proxy: { 
      type: "anchor_residential",
      active: true 
    }
  },
  browser: {
    adblock: { active: true },
    captcha_solver: { active: true },
    headless: { active: false }
  }
};

const ANCHOR_API_KEY = "YOUR_ANCHOR_API_KEY"; // Replace with your actual API key

async function createBrowserSession() {
  const response = await fetch("https://api.anchorbrowser.io/v1/sessions", {
    method: "POST",
    headers: {
      "anchor-api-key": ANCHOR_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(browserConfiguration),
  });

  const json = await response.json();
  return json.data;
}

// Use the browser with the configuration
(async () => {
  const { id } = await createBrowserSession();
  const browser = await chromium.connectOverCDP(
    `wss://connect.anchorbrowser.io?apiKey=${ANCHOR_API_KEY}&sessionId=${id}`
  );

  // Use the browser instance as needed

  await browser.close();
})();