Skip to content

Automation API overview

ZestSSH’s automation API lets something outside the terminal run work on your saved hosts: a zestssh:// link, another Android app such as Tasker, a scheduled task on Android, or an iOS Shortcut. For each request ZestSSH signs in to the host, runs the command without opening a terminal tab, collects what it printed and its exit code, and disconnects.

The automation API needs Squeezed. It is off until you turn it on, and every request must carry one of your API keys.

Way in Platforms Asks you first?
A zestssh://execute, snippet, batch or workflow link Android, iPhone and iPad, Windows, macOS, Linux Yes: Run this from a link?
An Android intent (Tasker and similar apps) Android No
A scheduled task Android No, while ZestSSH is open; otherwise you tap its notification (see Scheduled tasks)

Any web page or app can open a link, so a link never runs before you tap Run. An intent and a scheduled task run with nobody asked, which is why every run signs in only with keys you allowed for it (see Unattended runs).

How a computer gets zestssh:// links:

  • Windows: the installer registers the link type for your account.
  • macOS: the app declares the link type.
  • Linux: run install-desktop-entry.sh once from the unpacked ZestSSH folder (and again after you move the folder). It adds ZestSSH to your applications and makes it the app that opens zestssh:// links, for your account only and without root.

On every computer, a link opened while ZestSSH is running goes to the ZestSSH that is already open, and its window comes to the front. A link that comes while the app is still starting is kept and answered once it has started.

A computer has no intents and no scheduled tasks, so on a computer the automation API is reached through links only.

Another app, a link, or a schedule
|
v
[zestssh:// link] -> "Run this from a link?" -> Run
[Android intent or scheduled task] -> (no question)
|
v
[Checks] Squeezed, automation on, API key, the key's scope
|
v
[Run] sign in as a session to the host would, run, collect output, disconnect
|
v
[Result] saved in the automation history; handed back to an Android app that asked for it
  • On a computer: open Automation in the sidebar and click the Automations on switch at the right of the page’s top band, then confirm Enable external automation? with Enable.
  • On a phone: open More > Automation, turn on External automation, and confirm Enable external automation? with Enable.

Without Squeezed the switch cannot be turned on. While automation is off on a computer, the Automation page says “Automation is off. Deep links and webhooks are ignored.” with a Turn on automation button (Upgrade to Squeezed without Squeezed).

When a zestssh://execute, snippet, batch or workflow link opens the app, ZestSSH shows Run this from a link? It names what would run and where, for example “A link asks to run this command on web-01:” and the command. For a snippet it shows the snippet’s command with the link’s values filled in. It ends with “Run it only if you opened this link yourself.” Nothing runs until you tap Run.

  • Hosts are named as your personal space names them.
  • A character that would hide or reorder the command is shown as its code.
  • With recording mode on, ZestSSH first asks you to turn it off, so the question shows the real command. If you keep recording on, nothing runs.
  • A link that arrives while the app is locked waits until you unlock it. If several arrive, only the latest one waits.

There is no way to skip the question. For runs with nobody there, use an Android intent or a scheduled task.

  1. Squeezed: without it the request is refused.
  2. Automation on: while it is off the request is refused.
  3. API key: the key must be one of this device’s and not expired, and must pass the rate limit. See API authentication.
  4. Key scope: a key limited to one host refuses any other host, and refuses every workflow.
  5. Sign-in: the unattended rules below.

When automation does not run what a link or another app asked, ZestSSH shows a notice that says why, for example “Automation is off, so the command was not run.”

A run works on the hosts of your personal space, whatever space is on screen. It signs in to a host the way a session to it would: as your current network has the host, through its jump hosts, and with its key’s certificate.

Every run the automation API makes counts as a run with nobody there, a link’s run included once you tap Run. Such a run:

  • Signs in only with keys switched to Allow unattended runs in Keys (the keys of the host’s jump hosts and the key a network gives the host included). On a computer, pick the key, choose Edit, and turn it on under Unattended runs; on a phone it is in the key’s editor once the key is saved.
  • Trusts only host keys this device already trusts. Connect to a new host yourself once so its key is saved. A host whose key changed is refused.
  • Answers no question at sign-in. Where a server asks for a code, or for a password that is not saved, the run stops.
  • The command runs without a terminal (no PTY), so it suits commands that print and end. Full-screen programs such as top or an editor do not work here.
  • Each run has a timeout: 30 seconds unless the request sets one, from 1 to 300 seconds (larger values are cut to 300). It covers connecting, signing in, running and collecting output.
  • At most 1 MiB of standard output and 1 MiB of error output is kept per run.
  • When time runs out, the result says how far the run had come, for example “The sign-in had not finished when the time allowed was up (30s).”

The connection value is matched first against a host’s ID, then against its name in any letter case. There is no partial match: connection=prod matches a host named exactly prod (or PROD), never “prod-staging”. A request that names no saved host fails with “Connection not found:” and the name.

Each run is saved on this device with its time, action, host, command, output, error output, exit code, result and how long it took. A batch saves one entry per host. The history keeps the newest 500 entries.

  • On a computer: Automation > Runs.
  • On a phone: More > Automation > Automation history.
Action What it does Link Android intent
execute Runs one command on a host Yes Yes
snippet Runs a saved snippet, with optional variables Yes Yes
batch Runs one command on several hosts Yes Yes
workflow Runs a saved workflow by name or ID, if it may start from outside Yes Yes
connect Checks that a host can be reached No (see below) Yes
open Opens a lasting session, so its tunnels come up No Yes

zestssh://connect links are not automation and take no API key: they open a saved host after asking, or open Quick connect with an address typed in. Every parameter is on API endpoints.