361 · API reference
361 supports both HTTP and OpenURL; calling HTTP from Lua is recommended.
| Item | Value |
|---|---|
| HTTP base URL | http://127.0.0.1:361 |
| OpenURL | Replace http://127.0.0.1:361/ with 361:// |
| Method | GET |
| Command format | /cmd?fun=command¶ms |
| Async status file | /var/mobile/script_status |
OpenURL example:
-- HTTP
http.request("http://127.0.0.1:361/cmd?fun=newDevice&bid=com.apple.weather")
-- The equivalent OpenURL
openURL("361://cmd?fun=newDevice&bid=com.apple.weather")Return values
HTTP response
The endpoint returns JSON. Check status to see whether the call succeeded; the failure reason is in errMsg:
{"status": 1}
{"status": 0, "errMsg": "failure reason"}Async status file
newDevice, newBackup and restoreBackup are asynchronous: a successful HTTP response only means the task has started. The real outcome is in /var/mobile/script_status:
| State | Meaning |
|---|---|
| File does not exist | Not finished yet — keep waiting |
1 | Success |
0 | Failure |
-1 | No permission |
Common parameters
| Parameter | Notes |
|---|---|
bid | Bundle ID of the target app. newDevice accepts several, separated by commas, such as com.xxx.a,cn.yyy.b |
index | Backup row number, starting at 0 |
Endpoint list
| Function | Command | Type |
|---|---|---|
| Reset | newDevice | async |
| Create a backup | newBackup | async |
| List backups | getBackups | sync |
| Rename a backup | renameBackup | sync |
| Delete a backup | deleteBackup | sync |
| Restore a backup | restoreBackup | async |
| Get virtual device info | getCurrentVDInfo | sync |
| Set IDFA | setCurrentVDInfo | sync |
| Device ID and license | license | sync |
| Automatic switches | autoBackup · autoAppLaunch · autoIP | sync |
| Uninstall an app | uninstallApp | sync |
| Open an app | goToApp | sync |
Endpoint details
Reset async
GET http://127.0.0.1:361/cmd?fun=newDevice&bid=com.xxx.a,cn.yyy.b| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app; comma-separate several |
Generates a new virtual device environment for the given app. Poll script_status afterwards.
Create a backup async
GET http://127.0.0.1:361/cmd?fun=newBackup&bid=com.xxx.a| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
Creates a backup of the current environment.
List backups
GET http://127.0.0.1:361/cmd?fun=getBackups&bid=com.xxx.a| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
Returns JSON with the app's backup list, the timestamp of each backup, and the currently linked backup ID. The order of the list is the index row number.
Rename a backup
GET http://127.0.0.1:361/cmd?fun=renameBackup&bid=com.xxx&index=0&name=NewName| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
name | Yes | New name |
index | Pick one | Backup row number |
indexup | Pick one | Offset from the current backup: 1 for the previous one, 0 for the next one |
backname | Pick one | Locate the backup by its original name |
Delete a backup
GET http://127.0.0.1:361/cmd?fun=deleteBackup&bid=com.xxx&index=0| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
index | Yes | Backup row number; -1 deletes every backup for that app |
Restore a backup async
GET http://127.0.0.1:361/cmd?fun=restoreBackup&bid=com.xxx&index=0| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
index | Yes | Row number of the backup to restore |
Restores the app environment to the given backup. Poll script_status afterwards.
Get virtual device info
GET http://127.0.0.1:361/cmd?fun=getCurrentVDInfo&bid=com.xxx| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
Returns the current virtual device parameters, including IDFA, IDFV, iOS version, SSID, IMEI and UDID.
Set IDFA
GET http://127.0.0.1:361/cmd?fun=setCurrentVDInfo&bid=com.xxx&idfa=89B0...EB2| Parameter | Required | Notes |
|---|---|---|
bid | Yes | Target app |
idfa | Yes | The new IDFA value |
Device ID and license
GET http://127.0.0.1:361/cmd?fun=licenseReturns the device ID as deviceId and the license expiry as endDate. Use it at script start-up to check whether the license has expired.
Automatic switches
GET http://127.0.0.1:361/cmd?fun=autoBackup&open=1fun value | Notes |
|---|---|
autoBackup | Automatic backup |
autoAppLaunch | Automatic app launch |
autoIP | Automatic IP rotation |
| Parameter | Required | Notes |
|---|---|---|
open | Yes | 1 to turn on, 0 to turn off |
Uninstall an app
GET http://127.0.0.1:361/cmd?fun=uninstallApp&bid=com.xxxUninstalls the given app by Bundle ID.
Open an app
GET http://127.0.0.1:361/cmd?fun=goToApp&bid=com.xxxLaunches and switches to the given app.
Lua example (TouchSprite)
local sz = require("sz")
local http = require("szocket.http")
local BASE = "http://127.0.0.1:361/cmd?fun="
local STATUS_FILE = "/var/mobile/script_status"
-- Synchronous call, returns the parsed JSON
function R361(query)
local res, code = http.request(BASE .. query)
if code == 200 then
return sz.json.decode(res)
end
end
-- Wait for the async task: 1 = success / 0 = failure / -1 = no permission / nil = timeout
function Wait361(timeout)
timeout = timeout or 120
for i = 1, timeout do
mSleep(1000)
if isFileExist(STATUS_FILE) then
return tonumber(readFileString(STATUS_FILE))
end
end
end
-- Async call = start it, then wait
function R361Async(query)
-- Recommended: delete the previous status file so you cannot read a stale result
if isFileExist(STATUS_FILE) then delFile(STATUS_FILE) end
local json = R361(query)
if not json then return nil end
if json.status ~= 1 then
toast("call failed:" .. tostring(json.errMsg), 2)
return 0
end
return Wait361()
end
-- Launch 361
runApp("cn.tinyapps.RST")
mSleep(5000)
-- Check the license
local lic = R361("license")
if lic then toast("Expires: " .. tostring(lic.endDate), 2) end
-- Reset (comma-separate several apps)
local r = R361Async("newDevice&bid=com.apple.weather")
if r == 1 then
toast("reset succeeded", 2)
elseif r == -1 then
toast("no permission", 2)
else
toast("Reset failed", 2)
end
-- Restore backup number 0
R361Async("restoreBackup&bid=com.apple.weather&index=0")
-- Delete every backup of one app
R361("deleteBackup&bid=com.apple.weather&index=-1")Tip
The example deletes the old status file before calling, so it cannot read a stale result. If 361 clears that file itself on your build, drop that step.
For usage, see the 361 user guide.
The interface and supported systems may change with updates. Back up important data before cleaning, resetting or deleting anything.
