How to trigger AFT! jobs from the command line
AsAFT! provides two commands for running scripts from a shell or a CI/CD pipeline.
| Command | What it does |
aft start |
Calls the REST API of |
aft run |
Executes a .syncjs file directly in the calling shell |
aft start: trigger a RESTstored script via API
Prerequisite
First of all, you need to make sure you meet the prerequisites, which is basically only one: you need to createCreate an API Keykey fromin insidethe AFT!'s web interface,UI andunder makeSettings > API Keys. Make sure suchthe APIkey's KeyIP canallowlist includes the machine you will be usedcalling from. For calls from the IPsame address you'll be calling it from. Here's an example API Key that will work when invoked frommachine, 127.0.0.1 (localhost):is sufficient.
Minimal example
Once you have the API Key, you can use it to invoke the START command via command-line.Linux/MacOS:
./aft start -n "My Backup Job" -a "xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj"
Here'sWindows the simplest example, using only the API Key and the ID of the script you want to run:(PowerShell):
.\aft.exe start -sn "p3fEoexohdHj6SXrvuT8H8"My Backup Job" -a "xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj"
OnceScript younames haveare thematched API Key, you can use it to invoke the START command via command-line.case-insensitively.
Here's
With parameters and a completeremote example,instance
Linux/MacOS:
aft explicitlystart adds\
the-n optional"My HOSTBackup andJob" PARAMETERS\
command-line-a payload:"xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj" \
--params '{"character":"goofy"}' \
--host "192.168.1.10:44399"
Windows (PowerShell):
.\aft.exe start `
-sn "p3fEoexohdHj6SXrvuT8H8"My Backup Job" `
-a "xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj" `
--params '{"[{\character":"goofy"}' `"name\`":\`"character\`",\`"value\`":\`"goofy\`"}]"
--host "127.0.0.1:192.168.1.10:44399"
BothInside ofthe thesescript, examplesread assumethe you'reparameter invokingwith themParam("character").
--host PowerShell...defaults pleaseto keep127.0.0.1:44399 when omitted.
aft run: execute a script file directly
The Allow CLI Run option must be enabled in mindAFT! Settings. It is disabled by default but an administrator can enable it.
Minimal example
Linux/MacOS:
./aft run -f "/opt/scripts/my-transfer.syncjs"
Windows (PowerShell):
.\aft.exe run -f "C:\Scripts\my-transfer.syncjs"
With parameters
Linux/MacOS:
./aft run -f "/opt/scripts/my-transfer.syncjs" -p '{"destination":"/archive/2026"}'
Windows (PowerShell):
.\aft.exe run -f "C:\Scripts\my-transfer.syncjs" -p '{"destination":"D:\Archive\2026"}'
Notes
aft runexecutes synchronously: the command blocks until the script finishes and exits with code 0 on success, or code 1 if the script crashes or fails.- If
aft serveis running on the same machine,aft runautomatically delegates to the running service so the script has full access to the VFS Library and secrets. Ifaft serveis not running, it opens the local database directly. - This makes aft run a natural fit for OS-cron jobs, CI/CD pipelines, and shell scripts that
otherneedshellsa(likedefinitivecmd.exeexitorcode.

