Cloud access for scripts
The Local API works only while Mirage is open on your computer. A script on a server can reach your cloud profiles directly instead: it becomes a device of its own, with its own keys, and works with one workspace while every app is closed.
The Mirage server cannot read your profiles: they are encrypted on your devices. So the script encrypts and decrypts them itself, with the SDK or the mirage command line. A plain HTTP request cannot see profile names.
The SDK and the command line are published on npm together with the public beta. Until then these commands do not find the packages.
Connect a script
You need cloud sync turned on (Settings › Account). In a team, you also need to manage automation there.
-
In Mirage, open Automation, find Cloud access for scripts, pick the workspace and click Connect a script.
-
Give it a name you will recognize, for example n8n on the office server, and click Next.
-
Mirage shows a command. Run it on the computer where the script will work, within 15 minutes:
Terminal window npm install -g @mirage-browser/climirage cloud enroll mrge_… --url https://… -
The command prints six digits. Type them in Mirage. They prove that the script you started is the one you approve, and not someone who intercepted the code.
The command saves the credentials to cli/cloud.json in Mirage’s data folder, readable by you only. Treat this file like a password: it holds the script’s keys. --credentials <file> or MIRAGE_CLOUD_CREDENTIALS keeps it elsewhere.
The script reaches only this workspace, with your rights in it. If you leave the team, it stops.
Work with profiles
mirage cloud profiles listmirage cloud profiles create "Shop 12" --os windows --tag us --proxy socks5://user:pass@203.0.113.5:1080mirage cloud profiles update <id> --status "Warm-up"mirage cloud profiles trash <id>From TypeScript:
import { readFile } from "node:fs/promises";import { MirageCloud } from "@mirage-browser/sdk/cloud";
const cloud = await MirageCloud.connect(JSON.parse(await readFile("cloud.json", "utf8")));for (const p of await cloud.profiles.list()) console.log(p.id, p.name, p.tags);const p = await cloud.profiles.create({ name: "Shop 12", os: "macos", tags: ["us"] });await cloud.profiles.update(p.id, { status: "Warm-up" });enrollAutomation({ url, code, onCode }) from the same module connects a script without the command line: show the digits that onCode receives and save what it returns.
From Python (pip install "mirage-browser-sdk[cloud]", which adds PyNaCl):
from mirage_sdk.cloud import MirageCloud, load_credentials
cloud = MirageCloud.connect(load_credentials("cloud.json"))for p in cloud.profiles.list(): print(p.id, p.name, p.tags)p = cloud.profiles.create("Shop 12", os="macos", tags=["us"])cloud.profiles.update(p.id, status="Warm-up")enroll_automation(url, code, on_code) connects a script from Python and returns the same credentials as mirage cloud enroll, so one file works for both.
The apps pick up the changes on their next sync. A profile created by a script gets its fingerprint in the app from the OS you chose and a random seed, the same way on every device.
Revoke
In Cloud access for scripts, click Revoke access next to the script. Its key stops at once. If you own or manage the workspace, its encryption key changes too, so the copy the script holds opens nothing new.
What a script cannot do
- Approve devices, change members or roles: these need one of your own devices.
- Reach another workspace: connect another script for it.
- Start profiles: that takes the app (Local API) or the headless runner, which runs local profiles only for now.