Preloaded Scripts
Returns every script in the organization's preloaded-scripts pool, newest first.
Preloaded scripts are switched on per organization from the backoffice; while off, every route under this tag answers 4236.
A preloaded script is created once in the pool and then linked to any number of the organization's machines (POST /machines/{id}/scripts/link), each link saying whether the script runs at the start of every session or once. A machine runs its linked scripts when its next session starts, after its preloaded files have been copied, one after another in link order. While they run the machine reports friendly_status: running_scripts and cannot be connected to.
Scripts are written for one OS (os): a PowerShell script (.ps1) for Windows machines or a bash script (.sh) for Linux machines, and can only be linked to machines of that OS. They run with the Vagon agent's privileges (LOCAL SYSTEM on Windows, root on Linux) before the user connects, so they can install and configure software but cannot reach the interactive desktop. A script is immutable: to change it, create a new one. linked_machine_count is the number of machines the script is currently linked to.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
The organization's preloaded-scripts pool
200OK2026-02-05T10:10:22ZPreloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
GET /organization-management/v1/scripts HTTP/1.1
Host: api.vagon.io
Accept: */*
{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z",
"scripts": [
{
"id": "7",
"type": "script",
"attributes": {
"name": "install-tools.ps1",
"os": "windows",
"size": 2048,
"checksum": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"created_at": "2026-01-01T00:00:00.000Z",
"linked_machine_count": 3
}
}
]
}Adds a script to the pool. The body travels in the request (script_body, up to 1 MB) and is stored as is; there is no separate upload step.
name must be a bare file name (no path separators), unique inside the pool, and it must end with the extension of its OS: .ps1 for windows, .sh for linux.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Content-Type
application/json
Body
name*
string
Script file name, .ps1 or .sh
os*
string
windows or linux
script_body*
string
The script, up to 1 MB
install-tools.ps1windowsPossible values: The script, up to 1 MB
winget install --silent Git.GitThe new script
200OK2026-02-05T10:10:22ZInvalid name, os or empty body
Script size exceeds the maximum allowed size (1 MB)
A script with that name already exists
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
POST /organization-management/v1/scripts HTTP/1.1
Host: api.vagon.io
Content-Type: application/json
Accept: */*
Content-Length: 93
{
"name": "install-tools.ps1",
"os": "windows",
"script_body": "winget install --silent Git.Git\n"
}{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z",
"script": {
"id": "7",
"type": "script",
"attributes": {
"name": "install-tools.ps1",
"os": "windows",
"size": 2048,
"checksum": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"created_at": "2026-01-01T00:00:00.000Z",
"linked_machine_count": 3
}
}
}Script removed from the pool
200OK2026-02-05T10:10:22ZScript not found
The script is still linked to at least one machine
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
DELETE /organization-management/v1/scripts/{id} HTTP/1.1
Host: api.vagon.io
Accept: */*
{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z"
}The reverse of POST /machines/{id}/scripts/link: links one pool script to one or more machines, all or nothing, with a run mode per machine. On each machine the script is appended to the existing run order. The two directions write the same links; use whichever fits the call, for example this one to roll a script out to a group of machines.
An API secret scoped to machine_ids must cover every machine in the body.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Content-Type
application/json
Path Parameters
id*
integer
Script ID
Body
machines*
array
Objects with machine_id (integer) and optional run_mode (once, the default, or every_session)
The machines the script was linked to, in the order given, each with the script's position in that machine's run order
200OK2026-02-05T10:10:22Zmachines missing or empty, a repeated machine_id, or an unknown run_mode
Script or one of the machines not found
One of the machines runs the other operating system
The script is already linked to one of the machines
One of the machines is at its limit (20 scripts)
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required, or a machine in the body is outside the secret's machine scope
POST /organization-management/v1/scripts/{id}/link HTTP/1.1
Host: api.vagon.io
Content-Type: application/json
Accept: */*
Content-Length: 60
{
"machines": [
{
"machine_id": 101,
"run_mode": "every_session"
}
]
}{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z",
"machines": [
{
"id": "101",
"type": "machine",
"attributes": {
"name": "Design Workstation 3",
"os": "windows",
"run_mode": "every_session",
"position": 3,
"run_status": "pending",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_exit_code": null,
"last_error": null,
"linked_at": "2026-01-01T00:00:00.000Z"
}
}
]
}The reverse of POST /machines/{id}/scripts/unlink: unlinks one pool script from one or more machines. Nothing changes on the machines themselves; the script simply stops running at their session start. It stays in the pool.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Content-Type
application/json
Path Parameters
id*
integer
Script ID
Body
machine_ids*
array
Machine IDs
[101,102]Script unlinked from the machines
200OK2026-02-05T10:10:22Zmachine_ids missing or empty
Script not found, or it is not linked to one of the machines
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required, or a machine in the body is outside the secret's machine scope
POST /organization-management/v1/scripts/{id}/unlink HTTP/1.1
Host: api.vagon.io
Content-Type: application/json
Accept: */*
Content-Length: 25
{
"machine_ids": [
101,
102
]
}{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z"
}Returns the pool scripts linked to the machine in the order they run (position). run_mode is every_session or once. run_status is the outcome of the script's last run on this machine: pending until it runs, then succeeded (exit code 0) or failed (last_exit_code, last_error with the tail of the script's error output, or the reason it could not run, such as a timeout after 10 minutes). A once script runs at the next session start only while it is pending; a once script that failed is not retried on its own: unlink and link it again to get a fresh pending link. limit is the per-machine ceiling.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Path Parameters
id*
integer
Machine ID
Scripts linked to the machine, in run order
200OK2026-02-05T10:10:22ZPer-machine ceiling on linked scripts
20Machine not found or does not belong to the organization
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
GET /organization-management/v1/machines/{id}/scripts HTTP/1.1
Host: api.vagon.io
Accept: */*
{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z",
"scripts": [
{
"id": "7",
"type": "script",
"attributes": {
"name": "install-tools.ps1",
"os": "windows",
"size": 2048,
"run_mode": "every_session",
"position": 1,
"run_status": "succeeded",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_exit_code": 0,
"last_error": null,
"linked_at": "2026-01-01T00:00:00.000Z"
}
}
],
"limit": 20
}Links one or more pool scripts to the machine, all or nothing: if any script cannot be linked, nothing is linked and the matching error is returned. The scripts are appended to the machine's run order in the order given. Linking while the machine is running does not touch the running session; the scripts run when its next session starts.
A link is immutable: its run_mode cannot be changed afterwards. To change it, unlink the script and link it again with the new mode.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Content-Type
application/json
Path Parameters
id*
integer
Machine ID
Body
scripts*
array
Objects with script_id (integer) and optional run_mode (once, the default, or every_session)
The newly created links, with their positions in the machine's run order
200OK2026-02-05T10:10:22Zscripts missing or empty, a repeated script_id, or an unknown run_mode
Machine or one of the scripts not found
One of the scripts is written for the other operating system
One of the scripts is already linked to this machine
Linking these scripts would exceed the machine's limit (20 scripts)
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
POST /organization-management/v1/machines/{id}/scripts/link HTTP/1.1
Host: api.vagon.io
Content-Type: application/json
Accept: */*
Content-Length: 56
{
"scripts": [
{
"script_id": 7,
"run_mode": "every_session"
}
]
}{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z",
"scripts": [
{
"id": "7",
"type": "script",
"attributes": {
"name": "install-tools.ps1",
"os": "windows",
"size": 2048,
"run_mode": "every_session",
"position": 1,
"run_status": "succeeded",
"last_run_at": "2026-01-01T00:00:00.000Z",
"last_exit_code": 0,
"last_error": null,
"linked_at": "2026-01-01T00:00:00.000Z"
}
}
]
}Unlinks the given pool scripts from the machine. Nothing changes on the machine itself; the scripts simply stop running at session start. They stay in the pool.
Headers
Authorization*
HMAC {key}:{signature}:{nonce}:{timestamp}
Content-Type
application/json
Path Parameters
id*
integer
Machine ID
Body
script_ids*
array
Script IDs to unlink
[7,8]Scripts unlinked
200OK2026-02-05T10:10:22Zscript_ids missing or empty
Machine not found, or one of the scripts is not linked to it
Preloaded scripts are not enabled for this organization (switched on from the backoffice)
Permission required
POST /organization-management/v1/machines/{id}/scripts/unlink HTTP/1.1
Host: api.vagon.io
Content-Type: application/json
Accept: */*
Content-Length: 20
{
"script_ids": [
7,
8
]
}{
"client_code": 200,
"message": "OK",
"timestamp": "2026-02-05T10:10:22Z"
}Last updated