Run SSH command

Execute shell commands on your server via SSH. Returns stdout, stderr, and exit code. Requires an SFTP connection and the Pro plan.

Pro plan required. SSH command execution is available on the Pro plan and above. Upgrade your plan →

POST Endpoint

POST https://pushftp.com/api/exec/{connectionId}

Example

curl -X POST https://pushftp.com/api/exec/YOUR_CONNECTION_ID \
  -H "Authorization: Bearer pftp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"command": "ls -la /var/log/"}'

Log in to see your real API key and connection IDs here.

commandrequiredShell command to execute
timeoutoptionalMax execution time in seconds (default: 30, max: 300)

Response

{
  "stdout": "total 1234\n-rw-r--r-- 1 root root 5678 Mar 28 14:30 syslog\n...",
  "stderr": "",
  "exitCode": 0,
  "durationMs": 245,
  "transfer": {
    "id": "abc123",
    "connection": { "id": "xyz789", "name": "Production SFTP", "type": "sftp" }
  }
}

Use cases

  • Deploy scripts: cd /var/www && git pull && pm2 restart all
  • Database backups: pg_dump mydb > /backups/daily.sql
  • System health: df -h && free -m && uptime
  • Log analysis: tail -100 /var/log/nginx/error.log
  • File processing: convert input.png -resize 800x output.jpg

Limitations

  • Only works with SFTP connections (SSH-based). FTP and S3 connections will return a 400 error.
  • Max execution time: 5 minutes (300 seconds).
  • Commands run in a non-interactive shell. No TTY allocation.
  • Stdout and stderr are returned as strings. Binary output is not supported.
  • Counts as 1 action toward your monthly limit.

In Zapier

Use the "Run SSH Command" action in the PushFTP Zapier app. Select your SFTP connection, enter your command, and the stdout/stderr/exit code are available as fields in subsequent Zap steps.