Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Preloaded Scripts

List Scripts

get

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Responses
200

The organization's preloaded-scripts pool

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
get/scripts
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
      }
    }
  ]
}

Create Script

post

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Content-Type

application/json

Body

Name
Type
Description

name*

string

Script file name, .ps1 or .sh

os*

string

windows or linux

script_body*

string

The script, up to 1 MB

Body
namestringRequiredExample: install-tools.ps1
osstring · enumRequiredExample: windowsPossible values:
script_bodystringRequired

The script, up to 1 MB

Example: winget install --silent Git.Git
Responses
200

The new script

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
post/scripts
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
    }
  }
}

Delete Script

delete

Removes the script from the pool. Refused while the script is linked to any machine: unlink it everywhere first (POST /machines/{id}/scripts/unlink).

Headers

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Path Parameters

Name
Type
Description

id*

integer

Script ID

Responses
200

Script removed from the pool

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
delete/scripts/{id}
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"
}

Link Script to Machines

post

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Content-Type

application/json

Path Parameters

Name
Type
Description

id*

integer

Script ID

Body

Name
Type
Description

machines*

array

Objects with machine_id (integer) and optional run_mode (once, the default, or every_session)

Body
Responses
200

The machines the script was linked to, in the order given, each with the script's position in that machine's run order

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
post/scripts/{id}/link
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"
      }
    }
  ]
}

Unlink Script from Machines

post

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Content-Type

application/json

Path Parameters

Name
Type
Description

id*

integer

Script ID

Body

Name
Type
Description

machine_ids*

array

Machine IDs

Body
machine_idsinteger[]RequiredExample: [101,102]
Responses
200

Script unlinked from the machines

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
post/scripts/{id}/unlink
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"
}

List Machine Scripts

get

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Path Parameters

Name
Type
Description

id*

integer

Machine ID

Responses
200

Scripts linked to the machine, in run order

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
limitintegerOptional

Per-machine ceiling on linked scripts

Example: 20
get/machines/{id}/scripts
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
}

Link Scripts to Machine

post

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Content-Type

application/json

Path Parameters

Name
Type
Description

id*

integer

Machine ID

Body

Name
Type
Description

scripts*

array

Objects with script_id (integer) and optional run_mode (once, the default, or every_session)

Body
Responses
200

The newly created links, with their positions in the machine's run order

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
post/machines/{id}/scripts/link
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"
      }
    }
  ]
}

Unlink Scripts from Machine

post

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

Name
Type

Authorization*

HMAC {key}:{signature}:{nonce}:{timestamp}

Content-Type

application/json

Path Parameters

Name
Type
Description

id*

integer

Machine ID

Body

Name
Type
Description

script_ids*

array

Script IDs to unlink

Body
script_idsinteger[]RequiredExample: [7,8]
Responses
200

Scripts unlinked

application/json
client_codeintegerOptionalExample: 200
messagestringOptionalExample: OK
timestampstring · date-timeOptionalExample: 2026-02-05T10:10:22Z
post/machines/{id}/scripts/unlink
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