Update action

Change the trigger, delay, or server list on an existing action.


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.

Required attributes

  • Name
    trigger
    Type
    string
    Description

    Event that fires the script. Currently supported: server.booted, server.shutdown.

  • 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"
  }
}