Anti-Detect Browser Automation: Scripting Multi-Account Workflows

Anti-Detect Browser Automation: Scripting Multi-Account Workflows

Managing dozens or hundreds of browser profiles manually through an anti-detect browser interface is not scalable. Whether you are running an e-commerce operation across multiple marketplace accounts, managing social media clients, or conducting large-scale competitive research, automation is the key to efficiency.

Modern anti-detect browsers like Multilogin, GoLogin, and AdsPower offer APIs and automation frameworks that let you script profile creation, launch browsers programmatically, and execute tasks across hundreds of profiles simultaneously.

Why Automate Anti-Detect Browsers?

Manual workflows break down quickly when you scale beyond 10-20 profiles:

TaskManual Time (50 profiles)Automated Time
Create profiles2-3 hours5 minutes
Update proxy settings1-2 hours30 seconds
Login to accounts2-4 hours15 minutes
Post content3-5 hours20 minutes
Check account status1-2 hours5 minutes

Automation provides consistency (every profile configured identically), speed, and the ability to run tasks 24/7 without human intervention.

Multilogin Automation API

Multilogin X provides a comprehensive REST API for profile and browser management.

Starting Profiles via API

import requests
import json

MULTILOGIN_API = "https://api.multilogin.com"
TOKEN = "your_api_token"

headers = {
    "Authorization": f"Bearer {TOKEN}",
    "Content-Type": "application/json",
}

def create_profile(name, proxy_config):
    """Create a new browser profile with proxy."""
    payload = {
        "name": name,
        "browser": "mimic",  # or "stealthfox"
        "os": "windows",
        "proxy": {
            "type": proxy_config["type"],
            "host": proxy_config["host"],
            "port": proxy_config["port"],
            "username": proxy_config.get("username", ""),
            "password": proxy_config.get("password", ""),
        },
        "fingerprint": {
            "screen": {"width": 1920, "height": 1080},
            "timezone": "America/New_York",
            "language": "en-US",
        },
    }
    response = requests.post(
        f"{MULTILOGIN_API}/v2/profiles",
        headers=headers,
        json=payload,
    )
    return response.json()

def start_profile(profile_id):
    """Launch a browser profile and get WebSocket endpoint."""
    response = requests.post(
        f"{MULTILOGIN_API}/v2/profiles/{profile_id}/start",
        headers=headers,
    )
    data = response.json()
    return data.get("browserWSEndpoint")

def stop_profile(profile_id):
    """Close a running browser profile."""
    requests.post(
        f"{MULTILOGIN_API}/v2/profiles/{profile_id}/stop",
        headers=headers,
    )

Connecting Playwright to Multilogin

import asyncio
from playwright.async_api import async_playwright

async def automate_multilogin_profile(profile_id):
    """Connect Playwright to a running Multilogin profile."""
    # Start the profile and get WebSocket endpoint
    ws_endpoint = start_profile(profile_id)

    async with async_playwright() as p:
        # Connect to the running browser
        browser = await p.chromium.connect_over_cdp(ws_endpoint)
        context = browser.contexts[0]
        page = context.pages[0] if context.pages else await context.new_page()

        # Perform automated tasks
        await page.goto("https://example.com/login")
        await page.fill("#username", "myuser")
        await page.fill("#password", "mypass")
        await page.click("#login-button")
        await page.wait_for_load_state("networkidle")

        # Take screenshot for verification
        await page.screenshot(path=f"profile_{profile_id}.png")

        # Close connection (profile stays running)
        await browser.close()

    # Stop the profile
    stop_profile(profile_id)

asyncio.run(automate_multilogin_profile("abc123"))

GoLogin Automation API

GoLogin provides a Node.js SDK and REST API for automation.

Node.js SDK Approach

const GoLogin = require("gologin");

async function automateGoLogin() {
  const gl = new GoLogin({
    token: "your_gologin_api_token",
    profile_id: "profile_id_here",
  });

  // Start the profile
  const { status, wsUrl } = await gl.start();
  console.log(`Profile started: ${status}`);

  // Connect Puppeteer
  const puppeteer = require("puppeteer-core");
  const browser = await puppeteer.connect({
    browserWSEndpoint: wsUrl,
    ignoreHTTPSErrors: true,
  });

  const page = await browser.newPage();
  await page.goto("https://example.com");
  console.log(await page.title());

  // Cleanup
  await browser.close();
  await gl.stop();
}

automateGoLogin();

Python REST API

import requests

GOLOGIN_API = "https://api.gologin.com"
TOKEN = "your_token"

headers = {"Authorization": f"Bearer {TOKEN}"}

def create_gologin_profile(name, proxy):
    """Create a GoLogin profile."""
    payload = {
        "name": name,
        "os": "win",
        "navigator": {
            "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
            "language": "en-US",
            "platform": "Win32",
        },
        "proxy": {
            "mode": "http",
            "host": proxy["host"],
            "port": proxy["port"],
            "username": proxy.get("user", ""),
            "password": proxy.get("pass", ""),
        },
    }
    resp = requests.post(
        f"{GOLOGIN_API}/browser",
        headers=headers,
        json=payload,
    )
    return resp.json()["id"]

def batch_create_profiles(count, proxy_list):
    """Create multiple profiles with different proxies."""
    profiles = []
    for i in range(count):
        proxy = proxy_list[i % len(proxy_list)]
        profile_id = create_gologin_profile(f"Account_{i+1}", proxy)
        profiles.append(profile_id)
        print(f"Created profile {i+1}/{count}: {profile_id}")
    return profiles

AdsPower Local API

AdsPower uses a local API server running on your machine.

Profile Management

import requests

ADSPOWER_API = "http://local.adspower.net:50325"

def create_adspower_profile(name, proxy_config):
    """Create an AdsPower profile."""
    payload = {
        "name": name,
        "group_id": "0",
        "user_proxy_config": {
            "proxy_type": proxy_config["type"],  # http, socks5
            "proxy_host": proxy_config["host"],
            "proxy_port": str(proxy_config["port"]),
            "proxy_user": proxy_config.get("user", ""),
            "proxy_password": proxy_config.get("pass", ""),
        },
        "fingerprint_config": {
            "automatic_timezone": "1",
            "language": ["en-US", "en"],
            "screen_resolution": "1920_1080",
        },
    }
    resp = requests.post(f"{ADSPOWER_API}/api/v1/user/create", json=payload)
    return resp.json()

def open_browser(profile_id):
    """Open a browser profile and get automation port."""
    resp = requests.get(
        f"{ADSPOWER_API}/api/v1/browser/active",
        params={"user_id": profile_id},
    )
    data = resp.json()
    if data["code"] == 0:
        return data["data"]["ws"]["puppeteer"]
    return None

def close_browser(profile_id):
    """Close a running browser."""
    requests.get(
        f"{ADSPOWER_API}/api/v1/browser/stop",
        params={"user_id": profile_id},
    )

Selenium Integration with AdsPower

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import requests

def connect_selenium_to_adspower(profile_id):
    """Connect Selenium to an AdsPower profile."""
    # Open the profile
    resp = requests.get(
        f"http://local.adspower.net:50325/api/v1/browser/start",
        params={"user_id": profile_id},
    )
    data = resp.json()["data"]

    # Connect Selenium
    chrome_options = Options()
    chrome_options.debugger_address = data["ws"]["selenium"]

    service = Service(data["webdriver"])
    driver = webdriver.Chrome(service=service, options=chrome_options)

    return driver

# Usage
driver = connect_selenium_to_adspower("profile_123")
driver.get("https://example.com")
print(driver.title)
driver.quit()

Multi-Profile Task Runner

Here is a framework for running tasks across multiple anti-detect browser profiles:

import asyncio
import logging
from dataclasses import dataclass
from typing import Callable, List
from playwright.async_api import async_playwright, Page

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

@dataclass
class ProfileTask:
    profile_id: str
    profile_name: str
    ws_endpoint: str

class MultiProfileRunner:
    def __init__(self, max_concurrent=5):
        self.max_concurrent = max_concurrent
        self.semaphore = asyncio.Semaphore(max_concurrent)
        self.results = {}

    async def run_task(self, task: ProfileTask, action: Callable):
        """Run an action on a single profile."""
        async with self.semaphore:
            logger.info(f"Starting task for {task.profile_name}")
            try:
                async with async_playwright() as p:
                    browser = await p.chromium.connect_over_cdp(task.ws_endpoint)
                    context = browser.contexts[0]
                    page = context.pages[0] if context.pages else await context.new_page()

                    result = await action(page, task)
                    self.results[task.profile_id] = {"status": "success", "data": result}

                    await browser.close()
            except Exception as e:
                logger.error(f"Error for {task.profile_name}: {e}")
                self.results[task.profile_id] = {"status": "error", "error": str(e)}

    async def run_all(self, tasks: List[ProfileTask], action: Callable):
        """Run an action across all profiles concurrently."""
        await asyncio.gather(*[
            self.run_task(task, action) for task in tasks
        ])
        return self.results

# Example action: check account status
async def check_account_status(page: Page, task: ProfileTask):
    await page.goto("https://example.com/dashboard")
    await page.wait_for_load_state("networkidle")
    status = await page.text_content(".account-status")
    return {"account_status": status}

Proxy Integration Best Practices

When automating anti-detect browsers, proxy configuration is critical. Each profile should use a unique residential proxy or ISP proxy to maintain account isolation.

def assign_proxies_to_profiles(profiles, proxy_pool):
    """Assign unique sticky proxies to each profile."""
    assignments = {}
    for i, profile in enumerate(profiles):
        proxy = proxy_pool[i % len(proxy_pool)]
        # Use sticky sessions so each profile gets a consistent IP
        sticky_proxy = {
            "type": "http",
            "host": proxy["host"],
            "port": proxy["port"],
            "username": f"{proxy['user']}-session-{profile['id']}",
            "password": proxy["pass"],
        }
        assignments[profile["id"]] = sticky_proxy
    return assignments

For more on proxy rotation strategies, see our guide on how proxy rotation works and rotating vs sticky sessions.

FAQ

Which anti-detect browser has the best automation API?

Multilogin X offers the most comprehensive API with full profile management, Playwright/Puppeteer support, and team collaboration features. GoLogin provides a solid Node.js SDK. AdsPower uses a local API that is simple but effective for desktop automation.

Can I automate anti-detect browsers without the API?

Yes. You can use Selenium or Playwright to connect to any browser that exposes a remote debugging port. Most anti-detect browsers provide this option, though the official APIs offer better profile management.

How many profiles can I automate simultaneously?

This depends on your hardware. Each browser profile consumes 200-500MB of RAM. A machine with 32GB RAM can typically handle 30-50 concurrent profiles. Use cloud VMs for larger scale.

Is anti-detect browser automation detectable?

Anti-detect browsers are designed to prevent detection. However, automated behavior patterns (identical timing, systematic navigation) can trigger bot detection systems. Add random delays, vary actions, and simulate human-like behavior in your scripts.

How do I handle CAPTCHAs in automated anti-detect workflows?

Integrate a CAPTCHA solving service into your automation pipeline. Services like 2Captcha or CapSolver can solve reCAPTCHA and hCaptcha programmatically. Alternatively, use high-quality mobile proxies which encounter fewer CAPTCHAs.


Related Reading

Scroll to Top