Skip to content

Move a script from Dolphin Anty

Mirage can answer the few Dolphin Anty endpoints that scripts use to drive profiles. Your script keeps its requests; you change where it sends them, the token and one line that connects Playwright.

1. Turn on compatibility

In Mirage, open Automation, then:

  1. Under API keys, create a key for Scripts and SDK with See profiles and Start and stop profiles. Copy it: it is shown once.
  2. Turn on Dolphin Anty compatibility. It listens on 127.0.0.1:3001, Dolphin’s own port. If Dolphin runs on the same computer, pick another port and save it.

Only programs on this computer can connect. Browser pages cannot call it, as with the Local API.

2. Change the script

In your Dolphin script With Mirage
POST http://localhost:3001/v1.0/auth/login-with-token with your Dolphin token the same request with the Mirage key
profile ids from https://dolphin-anty-api.com/browser_profiles GET http://localhost:3001/browser_profiles (same page, limit, query)
GET /v1.0/browser_profiles/{id}/start?automation=1 unchanged; returns automation.port and automation.wsEndpoint
GET /v1.0/browser_profiles/{id}/stop unchanged
POST https://dolphin-anty-api.com/browser_profiles with name, platform, notes POST http://localhost:3001/browser_profiles; answers browserProfileId
DELETE https://dolphin-anty-api.com/browser_profiles/{id} DELETE http://localhost:3001/browser_profiles/{id} (to the trash)
chromium.connectOverCDP(\ws://127.0.0.1:${port}${wsEndpoint}`)` unchanged for a Chrome profile; firefox.connect(…) for a Firefox profile

The start answer has automation.browser, the core the profile runs on:

  • chromium (Chrome profiles): automation.wsEndpoint is a CDP address, so chromium.connectOverCDP, Puppeteer’s puppeteer.connect({ browserWSEndpoint }) and other CDP clients work as with Dolphin, with any Playwright or Puppeteer version. automation.debuggerAddress (only with &debugger=1 in the start URL) is for Selenium (see SDK).
  • firefox (Firefox profiles): automation.wsEndpoint is a Playwright address. Connect with firefox.connect; your Playwright must have the minor version in automation.playwrightVersion.

automation.wsUrl is the whole address in both cases.

const base = "http://localhost:3001";
await fetch(`${base}/v1.0/auth/login-with-token`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ token: process.env.MIRAGE_API_KEY }),
});
const { data } = await (await fetch(`${base}/browser_profiles?query=Shop`)).json();
const { automation } = await (await fetch(`${base}/v1.0/browser_profiles/${data[0].id}/start?automation=1`)).json();
const browser = await firefox.connect(`ws://127.0.0.1:${automation.port}${automation.wsEndpoint}`);
const page = browser.contexts()[0].pages()[0] ?? (await browser.contexts()[0].newPage());
await page.goto("https://example.com");
await browser.close(); // disconnects the script; the profile keeps running
await fetch(`${base}/v1.0/browser_profiles/${data[0].id}/stop`);

What is different

  • Profile ids are Mirage ids (text), not numbers.
  • The list has Dolphin’s page fields (data, current_page, last_page, per_page, total). Each profile has id, name, notes, tags, status, proxy and running.
  • Creating takes name, platform (windows, macos, linux) and notes. Dolphin’s fingerprint fields are ignored: Mirage gives every profile a real device of that platform. Creating and deleting need a key with Create and edit profiles; a running profile is not deleted.
  • Any other Dolphin endpoint (proxies, cookies, fingerprints) answers 501 with "success": false and a link here. Use the Mirage Local API or the SDKs for them.
  • Puppeteer and Selenium work with Chrome profiles only. A Firefox profile takes Playwright.
  • Mirage keeps the profile’s fingerprint and proxy: CDP commands that change them (Emulation.setUserAgentOverride, Browser.setProxy and the like) are refused with a message that says so, and the rest of the script goes on.
  • Every request also accepts Authorization: Bearer <key> instead of logging in first.