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

AMG · API reference

AMG is controlled through a local HTTP API. Commands use the form /cmd?fun=command¶meters.

AZ tutorialsRead on siteUpdated 2026-11-01
ItemValue
HTTP base URLhttp://127.0.0.1:8080
MethodGET
Bundle IDcom.superdev.AMG
Result file/var/mobile/amgResult.txt
Record folder/var/mobile/AMG/
Config file/private/var/mobile/Library/Preferences/AMG/config.plist

Before you call anything

  1. Download the official ts.so plugin in TouchSprite (More → Plugins in the bottom-right corner). The parameter files are plists, so you need it to read and write them.
  2. Before each call, make sure AMG is in the foreground. If it is not, run runApp("com.superdev.AMG") and wait about 3 seconds.

Return values

After calling, poll /var/mobile/amgResult.txt:

ValueMeaning
1Success
0Failure
2Running — keep waiting

How long to wait

Waiting time depends on how many apps you selected and how large the backups are. With smart airplane mode on, wait at least 15 seconds each time. When running scripts it is better to turn smart airplane mode off and check the IP inside the script instead.

Endpoint list

FunctionCommandParameters
Original deviceoriginRecord—
ResetnewRecord—
Next recordnextRecord—
First recordfirstRecord—
Restore a specific recordsetRecordrecordName
Get the current record namegetCurrentRecordName—
Get every record namegetAllRecordNamessaveFilePath
Rename a recordsetRecordNameoldName newName
Delete a specific recorddeleteRecordrecordName
Delete every recorddeleteAllRecords—
Disable / enable a specific recorddisableRecord · enableRecordrecordName
Disable / enable every recorddisableAllRecord · enableAllRecord—
Get the current record's parametersgetCurrentRecordParamsaveFilePath
Set the current record's parameterssetCurrentRecordParamfilePath
Get a specific record's parametersgetRecordParamrecordName saveFilePath
Set a specific record's parameterssetRecordParamrecordName filePath

Endpoint details

Original device

GET http://127.0.0.1:8080/cmd?fun=originRecord

Turns spoofing off and returns to the real device.

Reset

GET http://127.0.0.1:8080/cmd?fun=newRecord

Generates a new device from the current settings and creates a record.

Next record

GET http://127.0.0.1:8080/cmd?fun=nextRecord

Switches to the next record. Calling it again after the last one returns to the original device, so you can use Get the current record name to tell whether a full cycle has finished.

First record

GET http://127.0.0.1:8080/cmd?fun=firstRecord

Restores the first record.

Restore a specific record

GET http://127.0.0.1:8080/cmd?fun=setRecord&recordName=A10086
ParameterRequiredNotes
recordNameYesRecord name. The record must exist

Get the current record name

GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordName

The name comes back in the HTTP response body itself. When the result file reads 1, read the response body. On the original device it returns the name of the built-in original record.

Get every record name

GET http://127.0.0.1:8080/cmd?fun=getAllRecordNames&saveFilePath=/var/mobile/AMG_All_Record.plist
ParameterRequiredNotes
saveFilePathYesWhere to save the list of names (a plist). Delete any old file before calling

Rename a record

GET http://127.0.0.1:8080/cmd?fun=setRecordName&oldName=old-name&newName=new-name
ParameterRequiredNotes
oldNameYesCurrent record name. You can get it with getCurrentRecordName first
newNameYesNew record name

Delete a specific record

GET http://127.0.0.1:8080/cmd?fun=deleteRecord&recordName=2018-11-11-11-11-11-11
ParameterRequiredNotes
recordNameYesName of the record to delete

Delete every record

GET http://127.0.0.1:8080/cmd?fun=deleteAllRecords

Deletes all records but keeps the one currently in use. To wipe everything, call originRecord first to return to the original device, then delete.

Disable / enable a specific record

GET http://127.0.0.1:8080/cmd?fun=disableRecord&recordName=record-name
GET http://127.0.0.1:8080/cmd?fun=enableRecord&recordName=record-name
ParameterRequiredNotes
recordNameYesRecord name

Disable / enable every record

GET http://127.0.0.1:8080/cmd?fun=disableAllRecord
GET http://127.0.0.1:8080/cmd?fun=enableAllRecord

Warning

These two commands are AllRecord (singular), not AllRecords.

Get the current record's parameters

GET http://127.0.0.1:8080/cmd?fun=getCurrentRecordParam&saveFilePath=/var/mobile/AMG_Param.plist
ParameterRequiredNotes
saveFilePathYesWhere to save the parameters (a plist). Delete any old file before calling

Set the current record's parameters

GET http://127.0.0.1:8080/cmd?fun=setCurrentRecordParam&filePath=/var/mobile/AMG_Param.plist
ParameterRequiredNotes
filePathYesPath to the edited parameter file

Correct flow: getCurrentRecordParam to export → plist.read to load and edit the fields → plist.write to save → then call this endpoint.

Get a specific record's parameters

GET http://127.0.0.1:8080/cmd?fun=getRecordParam&recordName=record-name&saveFilePath=/var/mobile/AMG_Param.plist
ParameterRequiredNotes
recordNameYesRecord name
saveFilePathYesWhere to save the parameters

Set a specific record's parameters

GET http://127.0.0.1:8080/cmd?fun=setRecordParam&recordName=record-name&filePath=/var/mobile/AMG_Param.plist
ParameterRequiredNotes
recordNameYesRecord name
filePathYesPath to the edited parameter file

Parameter file

Parameter files are plists, read and written with ts.plist. Common fields:

FieldNotes
DeviceTokenPush notification token
LongitudeLongitude, e.g. 121.4997661114
LatitudeLatitude, e.g. 31.2394855667
ModelDevice model, e.g. iPhone X
SystemVeriOS version, e.g. 12.1.2

The exported file is the authoritative list of fields.

Device model and iOS version switches

To change Model or SystemVer you must also turn on the matching switch in config.plist, otherwise nothing happens:

Config keyNotes
fakeDeviceModel"1" enables the custom model, "0" restores it
fakeSystemVer"1" enables the custom iOS version, "0" restores it

Available models: iPhone 4, 4s, 5c, 5, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max.

Lua example (TouchSprite)

Put the wrapper below at the top of your script, then call functions such as AMG.New() directly.

lua
require "TSLib"
local sz = require("sz")
local http = require("szocket.http")

if isFileExist(userPath() .. "/plugin/ts.so") == false then
    dialog("ts.so plugin missing: open TouchSprite, tap More in the bottom-right corner, open Plugins and download the official ts.so", 0)
    lua_exit()
end
local ts = require("ts")
local plist = ts.plist

local BASE = "http://127.0.0.1:8080/cmd?fun="

-- Make sure AMG is in the foreground
function Check_AMG()
    if isFrontApp("com.superdev.AMG") == 0 then
        runApp("com.superdev.AMG")
        mSleep(3000)
    end
end

-- Poll the result: true = success / false = failure
function Check_AMG_Result()
    ::get::
    mSleep(3000)
    local f = "/var/mobile/amgResult.txt"
    if isFileExist(f) then
        local r = readFileString(f)
        if r == "0" then return false end
        if r == "1" then return true end
        if r == "2" then
            toast("in progress", 1)
            goto get
        end
    end
end

-- Generic call: returns (success, response body)
function AMG_Call(query)
    Check_AMG()
    local res, code = http.request(BASE .. query)
    if code == 200 then
        return Check_AMG_Result(), res
    end
    return false
end

local AMG = {
    Original    = function() return AMG_Call("originRecord") end,
    New         = function() return AMG_Call("newRecord") end,
    Next        = function() return AMG_Call("nextRecord") end,
    First       = function() return AMG_Call("firstRecord") end,
    Recover     = function(name) return AMG_Call("setRecord&recordName=" .. name) end,
    Rename      = function(old, new) return AMG_Call("setRecordName&oldName=" .. old .. "&newName=" .. new) end,
    Delete      = function(name) return AMG_Call("deleteRecord&recordName=" .. name) end,
    Delete_All  = function() return AMG_Call("deleteAllRecords") end,
    Disable     = function(name) return AMG_Call("disableRecord&recordName=" .. name) end,
    Enable      = function(name) return AMG_Call("enableRecord&recordName=" .. name) end,
    Disable_All = function() return AMG_Call("disableAllRecord") end,
    Enable_All  = function() return AMG_Call("enableAllRecord") end,

    Get_Name = function()
        local ok, res = AMG_Call("getCurrentRecordName")
        if ok then return res end
    end,

    Get_Param = function()
        local file = userPath() .. "/lua/AMG_Param.plist"
        if isFileExist(file) then delFile(file) end
        if AMG_Call("getCurrentRecordParam&saveFilePath=" .. file) then return file end
    end,

    Set_Param = function(file)
        return AMG_Call("setCurrentRecordParam&filePath=" .. file)
    end,

    Get_All_Record = function()
        local file = userPath() .. "/lua/AMG_All_Record.plist"
        if isFileExist(file) then delFile(file) end
        if AMG_Call("getAllRecordNames&saveFilePath=" .. file) then return file end
    end,
}

-- ===== Usage examples =====

-- Reset
if AMG.New() then toast("Reset complete", 3) end

-- Walk every record; coming back to the original device means a full cycle is done
AMG.First()
repeat
    -- ... your own logic here ...
    AMG.Next()
until AMG.Get_Name() == "Original device"

-- Change the current record's GPS position
local file = AMG.Get_Param()
if file then
    local p = plist.read(file)
    p["Longitude"] = "121.4997661114"
    p["Latitude"]  = "31.2394855667"
    plist.write(file, p)
    AMG.Set_Param(file)
end

-- Change the device model and iOS version (the config switches must be on too)
function Set_AMG_Config(key, value)
    local cfg_file = "/private/var/mobile/Library/Preferences/AMG/config.plist"
    local cfg = plist.read(cfg_file)
    cfg[key] = value
    plist.write(cfg_file, cfg)
end

Set_AMG_Config("fakeDeviceModel", "1")
Set_AMG_Config("fakeSystemVer", "1")
local file = AMG.Get_Param()
if file then
    local p = plist.read(file)
    p["Model"] = "iPhone X"
    p["SystemVer"] = "12.1.2"
    plist.write(file, p)
    AMG.Set_Param(file)
end

For usage, see the AMG user guide.

Note

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