Bắt đầu
Khi AirdropLogin đang mở, app chạy một REST API ngay trên máy bạn. Mọi việc làm được trong app (profile, proxy, chạy workflow, điện thoại ảo, bảng tính) đều gọi được từ script của bạn, bằng bất kỳ ngôn ngữ nào.
| Mục | Giá trị |
|---|---|
| Địa chỉ gốc | http://127.0.0.1:3939/api |
| Cổng | 3939; nếu bị chiếm thì 3940–3943. Cổng đang dùng ghi trong %APPDATA%\AirdropLogin\data\port.txt. |
| Xác thực | Không cần. API chỉ nghe trên 127.0.0.1, nên chỉ chương trình trên chính máy bạn gọi được. |
| Định dạng | Gửi và nhận JSON. Request POST có body thì gửi kèm Content-Type: application/json. |
| Lỗi | HTTP 400 kèm { "error": "nội dung lỗi" }. Thao tác không có gì trả về thì trả { "ok": true }. |
POST /api/runs báo lỗi.Lấy cổng từ script
PORT=$(cat "$APPDATA/AirdropLogin/data/port.txt" 2>/dev/null || echo 3939)
curl http://127.0.0.1:$PORT/api/profilesCác ví dụ bên dưới dùng hàm call() này.
Profiles
/api/profilesid, name, account, groups, tags, note, proxy, seed, platform, brand, timezone, lang, acceptLang, createdAt, running./api/profiles/createcount (tối đa 500), prefix, group, proxies (mỗi profile một proxy, theo thứ tự), platform, brand, timezone, lang, acceptLang./api/profiles/:idname, note, proxy, seed, timezone…). seed là số nguyên từ 1 đến 2147483647./api/profiles/bulkids, patch (trường cần đặt), addTags, removeTags, addGroups, removeGroups./api/profiles/:id/open/api/profiles/:id/close/api/close-all/api/profiles/:id/clone/api/profiles/:id/cookies/exportdomain. Trả về { cookies }./api/profiles/:id/cookies/importtext (JSON hoặc định dạng Netscape), domain, mode./api/profiles/resetids, giữ ID, tên, nhóm, proxy, tag./api/profiles/clear-cacheids./api/profiles/deleteids cùng dữ liệu trình duyệt. Không khôi phục được.Ví dụ: tạo 5 profile có proxy rồi mở profile đầu
curl -X POST http://127.0.0.1:3939/api/profiles/create -H "Content-Type: application/json" \
-d '{"count":5,"prefix":"shop","group":"Shop A","proxies":["1.2.3.4:8000:user:pass","1.2.3.5:8000:user:pass"]}'
curl http://127.0.0.1:3939/api/profiles
curl -X POST http://127.0.0.1:3939/api/profiles/PROFILE_ID/openNhóm
/api/groups/api/groups{ "name": "Shop A" } (tối đa 60 ký tự)./api/groups/deletename. Profile trong nhóm vẫn giữ nguyên.Muốn đưa profile vào nhóm, dùng POST /api/profiles/bulk với addGroups / removeGroups.
curl -X POST http://127.0.0.1:3939/api/profiles/bulk -H "Content-Type: application/json" \
-d '{"ids":["ID1","ID2"],"addGroups":["Shop A"],"addTags":["warmed"]}'Proxy
/api/proxy-checkproxy. Trả về IP mà proxy hiện ra với trang web./api/proxy-pool/api/proxy-pool/apply/api/proxy-pool/check/api/profiles/:id{ "proxy": "socks5://user:pass@host:port" }; chuỗi rỗng là bỏ proxy.Proxy IPv6
/api/ipv6/api/ipv6/create/api/ipv6/rotateids./api/ipv6/deleteids, hoặc tất cả với { "all": true }./api/ipv6/testid.Ví dụ: bỏ proxy chết
curl -X POST http://127.0.0.1:3939/api/proxy-check -H "Content-Type: application/json" -d '{"proxy":"1.2.3.4:8000:user:pass"}'Chạy workflow
/api/workflowsid để chạy)./api/tasks/api/runsworkflowId, profileIds, tuỳ chọn name, inputVars (biến của workflow) và config. Hoặc chạy task đã lưu với { taskId, profileIds }. Trả về lượt chạy kèm id.| Trường config | Mặc định | Ý nghĩa |
|---|---|---|
profileThreads | 3 | Số profile chạy cùng lúc |
delayOpenProfile | 2 | Số giây nghỉ giữa các lần mở profile |
headless | false | Chạy không hiện cửa sổ |
repeatTimes | 1 | Số lần chạy mỗi profile |
closeBrowser | true | Đóng trình duyệt khi profile chạy xong |
randomProfile | false | Xáo trộn thứ tự profile |
/api/runsstatus, startedAt, finishedAt và profiles[] gồm status, dòng log cuối, error của từng profile./api/runs/:id/logs/:profileId/api/runs/:id/stop{ profileId }./api/runs/:id/retryprofileIds trong cùng lượt./api/runs/:id/threads{ threads }./api/runs/delete{ ids } hoặc { allFinished: true }.Ví dụ: chạy workflow cho một nhóm và chờ xong
curl -X POST http://127.0.0.1:3939/api/runs -H "Content-Type: application/json" \
-d '{"workflowId":"WORKFLOW_ID","profileIds":["ID1","ID2"],"config":{"profileThreads":2}}'
curl http://127.0.0.1:3939/api/runsĐiện thoại ảo
ID điện thoại có dạng ph-1, ph-2… và dùng được làm profileIds trong POST /api/runs cho workflow 📱.
/api/phones/status/api/phones/machines/api/phones/createcount, prefix, group, cpu, memory, resolution./api/phones/clonefrom thành count bản./api/phones/launchids chạy nền. Trả về { launched }./api/phones/quitids; /api/phones/quit-all tắt tất cả./api/phones/installfile (đường dẫn đầy đủ trên máy) cho ids./api/phones/removeids./api/phones/:id/screen/api/phones/:id/input{type:"tap",x,y}, {type:"swipe",x1,y1,x2,y2,ms}, {type:"key",key} (vd KEYCODE_HOME), {type:"text",text}.Ngoài ra còn /api/phones/proxies, /location, /rename, /modify, /backup, /restore, tương ứng các nút ở trang Điện thoại.
curl -X POST http://127.0.0.1:3939/api/phones/launch -H "Content-Type: application/json" -d '{"ids":["ph-1"]}'
curl -X POST http://127.0.0.1:3939/api/phones/ph-1/input -H "Content-Type: application/json" -d '{"type":"tap","x":540,"y":1200}'
curl -o screen.png http://127.0.0.1:3939/api/phones/ph-1/screenBảng tính
Bảng tính là nơi workflow đọc và ghi dữ liệu (các node Spreadsheet).
/api/sheets/api/sheets/:idcells là mảng các hàng, mỗi hàng là mảng giá trị./api/sheets{ name }./api/sheets/import{ paths: ["C:\\data\\list.xlsx"] }, hoặc { name, data } kèm các hàng./api/sheets/:id/ops{ ops: [...] }. Mỗi op là {r, c, v} (ghi hàng r, cột c, đếm từ 0), {op:"insertRows",at,n}, {op:"deleteRows",rows}, {op:"insertCols",at,n} hoặc {op:"deleteCols",cols}./api/sheets/:id/export/api/sheets/:id/deletecurl -X POST http://127.0.0.1:3939/api/sheets -H "Content-Type: application/json" -d '{"name":"accounts"}'
curl -X POST http://127.0.0.1:3939/api/sheets/SHEET_ID/ops -H "Content-Type: application/json" \
-d '{"ops":[{"r":0,"c":0,"v":"Mail"},{"r":0,"c":1,"v":"Status"},{"r":1,"c":0,"v":"a@example.com"}]}'
curl -o accounts.xlsx http://127.0.0.1:3939/api/sheets/SHEET_ID/exportPuppeteer / Playwright
Profile do app mở đều có cổng Chrome DevTools, nên bạn điều khiển được bằng Puppeteer, Playwright hay công cụ CDP bất kỳ mà vẫn giữ fingerprint và proxy. Khi Chrome mở, nó ghi file DevToolsActivePort trong thư mục profile: dòng 1 là cổng, dòng 2 là đường dẫn WebSocket.
- Thư mục profile:
<profilesRoot>\<account>\<số>_<số>_<id>, vớiprofilesRootlấy từGET /api/settingsvàaccountlấy từGET /api/profiles. - Dùng
connect, đừng dùnglaunch: trình duyệt do app quản lý. Xong việc thìdisconnect()rồi đóng bằngPOST /api/profiles/:id/close. - Profile mở tay ở chế độ sạch (Cài đặt) không có cổng DevTools, nên script không kết nối được.
import fs from "node:fs";
import path from "node:path";
import puppeteer from "puppeteer-core";
const API = "http://127.0.0.1:3939/api";
const call = (m, r, b) => fetch(API + r, { method: m, headers: { "Content-Type": "application/json" }, body: b && JSON.stringify(b) }).then((x) => x.json());
async function connectProfile(id) {
const { profilesRoot } = await call("GET", "/settings");
const p = (await call("GET", "/profiles")).find((x) => x.id === id);
await call("POST", `/profiles/${id}/open`);
const base = path.join(profilesRoot, p.account);
const dir = path.join(base, fs.readdirSync(base).find((d) => d.endsWith("_" + id)));
const file = path.join(dir, "DevToolsActivePort");
for (let i = 0; i < 60 && !fs.existsSync(file); i++) await new Promise((ok) => setTimeout(ok, 500));
const [port, wsPath] = fs.readFileSync(file, "utf8").split(/\r?\n/);
return puppeteer.connect({ browserWSEndpoint: `ws://127.0.0.1:${port}${wsPath}`, defaultViewport: null });
}
const browser = await connectProfile("PROFILE_ID");
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.title());
await browser.disconnect();