Skip to main content

Calling the AFT! REST API directly to trigger a job

WithIf Syncplifyyou need to trigger an AFT! youjob have quitefrom a fewscript differentor waystool tothat cannot run and/orthe aft start command, you can call the execution of your secure file transfer jobs. One such way is via REST API. But how to invoke such REST API viadirectly. PowerShellAll you need is an API key and the name of the script you want to run.

Create the API key in anthe easyAFT! way?web Here'sUI anunder exampleAPI scriptKeys, forand you:make sure its IP allow-list includes the machine making the request.

Windows (PowerShell)

Minimal example:

$Headerheaders = @{ "X-API-Key" = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"your-api-key-here" }
$Bodybody    = @{ jobTypescriptName = "SCRIPT"My scriptIdBackup = "xxxxxxxxxxxxxxxxxxxxxx"Job" } $Parameters| =ConvertTo-Json

@{Invoke-RestMethod -Method =POST "POST"`
    -Uri         = "https://127.0.0.1:44399/v1/jobs" `
    -Headers =$headers $Header`
    -ContentType = "application/json" `
    -Body =$body ($Body | ConvertTo-Json)
}
 
Invoke-RestMethod @Parameters`
    -SkipCertificateCheck

AllWith parameters:

$headers = @{ "X-API-Key" = "your-api-key-here" }
$body    = @{
    scriptName = "My Backup Job"
    params     = @{ destination = "/archive/2026"; character = "goofy" }
} | ConvertTo-Json -Depth 3

Invoke-RestMethod -Method POST `
    -Uri "https://127.0.0.1:44399/v1/jobs" `
    -Headers $headers `
    -ContentType "application/json" `
    -Body $body `
    -SkipCertificateCheck
Linux/MacOS

Minimal example:

curl -sk -X POST https://127.0.0.1:44399/v1/jobs \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"scriptName":"My Backup Job"}'

With parameters:

curl -sk -X POST https://127.0.0.1:44399/v1/jobs \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"scriptName":"My Backup Job","params":{"destination":"/archive/2026","character":"goofy"}}'
Request-body reference
FieldTypeDescription
scriptNamestringName of the stored script to run (case-insensitive). Use this in new integrations.
scriptIdstringScript ID. Kept for backward compatibility with AFT! v3 integrations; prefer scriptName.
filePathstringPath to a .syncjs file on disk. Alternative to scriptName/scriptId.
paramsobjectNamed parameters passed to the script as a flat key/value object.

Exactly one of scriptName, scriptId, or filePath must be provided. On success the API returns 201 Created with a job info object containing the job ID, which you needcan use to dopoll GET /v1/adm/jobs/{id} for status.

The -SkipCertificateCheck / -sk flags are needed when AFT! is substituteusing a self-signed TLS certificate, which is the censoreddefault (xxxxxx...)for APIlocal Key and Script ID with your own values, and that's it, it'll work just fine.installations.