Update action
Change the trigger, delay, or server list on an existing action.
This endpoint requires the Unlimited plan.
PATCH/api/scripts/{script}/actions/{action}
Update an action
Servers added to the list are queued for install. Servers removed from the list are queued for uninstall — the systemd unit is torn down on those boxes before the pivot row is dropped. Changing the trigger re-installs the unit for the new trigger, or removes it when switching to an update trigger, which needs no unit.
Required attributes
- Name
trigger- Type
- string
- Description
Event that fires the script. One of:
server.booted: the server finished booting.server.shutdown: the server is shutting down gracefully.server.updates-finished: Ploi finished an update run on the server (the automatic updates schedule, "Run updates now" or fixing the updates insight).server.packages-upgraded: likeserver.updates-finished, but only when the run actually upgraded packages. Useful forpm2 update, or to reboot when/var/run/reboot-requiredexists (useshutdown -r +1so the script run can finish first).
- Name
servers- Type
- array
- Description
Full list of server IDs the action should run on. Servers not in this list are uninstalled.
Optional attributes
- Name
delay_seconds- Type
- integer
- Description
Delay before Ploi runs the script after the trigger fires. 0–7200 seconds.
Request
PATCH
/api/scripts/{script}/actions/{action}curl -X PATCH "https://ploi.io/api/scripts/{script}/actions/{action}" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"trigger": "server.booted",
"servers": [12],
"delay_seconds": 60
}'
Response
{
"data": {
"id": 1,
"script_id": 42,
"trigger": "server.booted",
"trigger_label": "Server has booted",
"delay_seconds": 60,
"is_paused": false,
"last_triggered_at": "2026-05-13T08:42:11+00:00",
"servers": [
{ "server_id": 12, "status": "installed", "installed_at": "2026-05-12T10:11:30+00:00", "last_error": null }
],
"created_at": "2026-05-12 10:11:22",
"updated_at": "2026-05-13 09:05:42"
}
}