AZ
Ten years of iOS privacy protection plugins
AZ TUTORIALS · API reference

361 · API reference

361 supports both HTTP and OpenURL; calling HTTP from Lua is recommended.

AZ tutorialsRead on siteUpdated 2026-11-01
ItemValue
HTTP base URLhttp://127.0.0.1:361
OpenURLReplace http://127.0.0.1:361/ with 361://
MethodGET
Command format/cmd?fun=command¶ms
Async status file/var/mobile/script_status

OpenURL example:

lua
-- 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:

json
{"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:

StateMeaning
File does not existNot finished yet — keep waiting
1Success
0Failure
-1No permission

Common parameters

ParameterNotes
bidBundle ID of the target app. newDevice accepts several, separated by commas, such as com.xxx.a,cn.yyy.b
indexBackup row number, starting at 0

Endpoint list

FunctionCommandType
ResetnewDeviceasync
Create a backupnewBackupasync
List backupsgetBackupssync
Rename a backuprenameBackupsync
Delete a backupdeleteBackupsync
Restore a backuprestoreBackupasync
Get virtual device infogetCurrentVDInfosync
Set IDFAsetCurrentVDInfosync
Device ID and licenselicensesync
Automatic switchesautoBackup · autoAppLaunch · autoIPsync
Uninstall an appuninstallAppsync
Open an appgoToAppsync

Endpoint details

Reset async

GET http://127.0.0.1:361/cmd?fun=newDevice&bid=com.xxx.a,cn.yyy.b
ParameterRequiredNotes
bidYesTarget 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
ParameterRequiredNotes
bidYesTarget app

Creates a backup of the current environment.

List backups

GET http://127.0.0.1:361/cmd?fun=getBackups&bid=com.xxx.a
ParameterRequiredNotes
bidYesTarget 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
ParameterRequiredNotes
bidYesTarget app
nameYesNew name
indexPick oneBackup row number
indexupPick oneOffset from the current backup: 1 for the previous one, 0 for the next one
backnamePick oneLocate the backup by its original name

Delete a backup

GET http://127.0.0.1:361/cmd?fun=deleteBackup&bid=com.xxx&index=0
ParameterRequiredNotes
bidYesTarget app
indexYesBackup 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
ParameterRequiredNotes
bidYesTarget app
indexYesRow 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
ParameterRequiredNotes
bidYesTarget 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
ParameterRequiredNotes
bidYesTarget app
idfaYesThe new IDFA value

Device ID and license

GET http://127.0.0.1:361/cmd?fun=license

Returns 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=1
fun valueNotes
autoBackupAutomatic backup
autoAppLaunchAutomatic app launch
autoIPAutomatic IP rotation
ParameterRequiredNotes
openYes1 to turn on, 0 to turn off

Uninstall an app

GET http://127.0.0.1:361/cmd?fun=uninstallApp&bid=com.xxx

Uninstalls the given app by Bundle ID.

Open an app

GET http://127.0.0.1:361/cmd?fun=goToApp&bid=com.xxx

Launches and switches to the given app.

Lua example (TouchSprite)

lua
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.

Note

The interface and supported systems may change with updates. Back up important data before cleaning, resetting or deleting anything.