Prepare your environment
API and CDP automation is included in Pro and Max; on other plans the API replies that your plan does not include it. Keep Mantis open and signed in on the same PC where the script runs. First prepare and test a profile through the interface.
- Request GET /v1/perfiles/abiertos to see the ones already open, including the ones you opened, or GET /v1/perfiles?q=<part of the name> to find one. Routes accept its id or its exact name.
- Start it with POST /v1/perfiles/:id/start and use automation.wsEndpoint from the response. If it is already open, it returns that same browser and does not open another one.
- Connect Playwright or Puppeteer to that endpoint; reuse the profile context to keep its cookies and settings.
- When finished, disconnect your tool and stop the profile if your task should close it.


Python with Playwright
Install dependencies with pip install requests playwright. This example connects to the Chromium launched by Mantis and stops the profile when finished; replace PROFILE_ID with your chosen id.
Python example
import requests
from playwright.sync_api import sync_playwright
API = "http://127.0.0.1:3848/v1"
PROFILE_ID = "REPLACE_WITH_PROFILE_ID"
def api(method, path):
response = requests.request(method, API + path, timeout=120)
response.raise_for_status()
return response
started = api("POST", f"/perfiles/{PROFILE_ID}/start").json()
try:
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(
started["automation"]["wsEndpoint"]
)
context = browser.contexts[0]
page = context.new_page()
page.goto("https://example.com")
print(page.title())
page.close()
finally:
api("POST", f"/perfiles/{PROFILE_ID}/stop")Node.js with Puppeteer
Install puppeteer-core and save this example as an .mjs file. Use a Node version with fetch. disconnect closes the automation connection; /stop closes the profile.
Node.js example
import puppeteer from "puppeteer-core";
const API = "http://127.0.0.1:3848/v1";
const PROFILE_ID = "REPLACE_WITH_PROFILE_ID";
async function api(path, method = "GET") {
const response = await fetch(API + path, { method });
if (!response.ok) {
throw new Error(response.status + ": " + await response.text());
}
return response;
}
const started = await (await api(
"/perfiles/" + PROFILE_ID + "/start", "POST"
)).json();
let browser;
try {
browser = await puppeteer.connect({
browserWSEndpoint: started.automation.wsEndpoint,
defaultViewport: null,
});
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.title());
await page.close();
} finally {
if (browser) await browser.disconnect();
await api("/perfiles/" + PROFILE_ID + "/stop", "POST");
}Working with multiple sessions
- Assign one profile per task and avoid two scripts controlling the same one at once.
- Limit how many you open at once by RAM, CPU and connection: each profile is a real browser.
- Keep the fingerprint in Mantis; do not override it from the script if you want to keep the profile’s identity.
- With an AI (Claude, ChatGPT, Codex…): in Automation click Copy instructions for an AI and paste them along with what you want it to do. They explain how to find your open profiles and connect without opening another browser.
- Selenium or other tools need a Chromium/CDP-compatible integration (debuggerAddress with the port returned by /start).