VM Management
Create, list, start, stop, snapshot, clone, and delete virtual machines with simple commands.
Every operation you perform in the VergeOS UI maps directly to a REST API call. This API-first design means anything you can click in the dashboard — creating VMs, configuring networks, managing tenants — can be automated through HTTP endpoints. This section covers the three primary interfaces for programmatic access: the REST API itself, the yb-api helper script for on-box automation, and the vrg CLI for remote management.
The VergeOS API follows standard REST conventions with JSON payloads, supporting the full lifecycle of every resource in the platform.
| Method | Purpose | Example |
|---|---|---|
| GET | Retrieve resources | GET /api/v4/vms?fields=most |
| POST | Create resources or trigger actions | POST /api/v4/vms |
| PUT | Update existing resources | PUT /api/v4/vms/36 |
| DELETE | Remove resources | DELETE /api/v4/vms/36 |
Every GET request supports powerful filtering and field selection:
fields — Specify which fields to return (e.g., fields=name,$key,ram or fields=most for all common fields)filter — OData-style filter expressions (e.g., filter=is_snapshot eq false)sort — Sort results by field (e.g., sort=name)limit / offset — Pagination controls for large result setsAll API responses are returned in JSON format. Request bodies for POST and PUT operations must also be JSON with the Content-Type: application/json header.
The API supports a maximum of 1,000 requests per hour per API key. For high-volume automation, batch operations where possible and implement retry logic with exponential backoff.
VergeOS supports three authentication methods, each suited to different use cases:
The simplest method — pass credentials directly with each request. All API traffic requires HTTPS.
curl -X GET "https://vergeos.example.com/api/v4/vms?fields=most" \ --basic --user "admin:password" \ -H "Accept: application/json"Request a session token by POSTing credentials to /sys/tokens. Use the returned token in subsequent requests via the x-yottabyte-token header:
# Step 1: Obtain a tokencurl --basic \ --data-ascii '{"login": "admin", "password": "secret"}' \ --request "POST" \ --header "Content-Type: application/json" \ "https://vergeos.example.com/api/sys/tokens"
# Response includes the token key:# {"location":"/sys/tokens/3a334...","$key":"3a334..."}
# Step 2: Use the token in subsequent requestscurl -X GET "https://vergeos.example.com/api/v4/vms?fields=most" \ -H "x-yottabyte-token: 3a334..." \ -H "Accept: application/json"
# Step 3: Logout when donecurl -X DELETE "https://vergeos.example.com/api/sys/tokens/3a334..."For production automation, create persistent API keys through System → Users → [User] → API Keys. These keys function as Bearer tokens and remain valid until expiration or deletion:
curl -X GET "https://vergeos.example.com/api/v4/vms?fields=most" \ -H "Authorization: Bearer your-api-key-string" \ -H "Content-Type: application/json"API keys support IP allow/deny lists for security and configurable expiration dates. Store them in environment variables rather than hardcoding:
export VERGEOS_API_KEY="your-api-key-string"curl -X GET "https://vergeos.example.com/api/v4/system" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}"VergeOS includes a built-in Swagger documentation page that is dynamically generated from the running system, showing every available table and operation.
To access it:
The Swagger interface lets you execute API calls in-browser and see the resulting curl command, response body, and headers — making it an excellent tool for prototyping automation scripts.
The API organizes resources into tables. Here are the most commonly used endpoints:
| Endpoint | Purpose |
|---|---|
/api/v4/vms | Virtual machine CRUD operations |
/api/v4/vm_actions | VM power operations, clone, snapshot |
/api/v4/machine_drives | Attach/manage VM storage drives |
/api/v4/machine_nics | Configure VM network interfaces |
/api/v4/machine_devices | GPU/PCI device passthrough |
/api/v4/machine_status/{id} | Runtime power state and status |
/api/v4/vnets | Virtual network management |
/api/v4/vnet_rules | Firewall and NAT rules |
/api/v4/tenants | Tenant (VDC) management |
/api/v4/nodes | Physical node information |
/api/v4/clusters | Cluster configuration |
/api/sys/tokens | Session token management |
Append /$table to any endpoint to retrieve its full database schema, including all available fields and types:
# Get the VM table schemacurl -X GET "https://vergeos.example.com/api/v4/vms/\$table" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}"The most common automation workflow is provisioning a complete VM through the API. This four-step process mirrors what the UI does behind the scenes:
curl -X POST "https://vergeos.example.com/api/v4/vms" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "name": "web-server-01", "description": "Production web server", "machine_type": "pc-q35-9.0", "cpu_cores": 4, "cpu_type": "Cascadelake-Server", "ram": 8192, "os_family": "linux", "boot_order": "cd", "uefi": true, "allow_hotplug": true }'
# Response: {"location":"/v4/vms/42","$key":"42"}curl -X POST "https://vergeos.example.com/api/v4/machine_drives" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "machine": 42, "name": "boot-disk", "size": 107374182400, "interface": "virtio", "media": "disk", "tier": 1 }'curl -X POST "https://vergeos.example.com/api/v4/machine_nics" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "machine": 42, "network": 6, "model": "virtio" }'curl -X POST "https://vergeos.example.com/api/v4/vm_actions" \ -H "Authorization: Bearer ${VERGEOS_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "vm": 42, "action": "poweron" }'Once the VM exists, you can trigger advanced operations through the same vm_actions endpoint:
# Clone a VMcurl -X POST ".../api/v4/vm_actions" \ -d '{"vm": 42, "action": "clone", "params": {"name": "web-server-clone", "quiesce": "true"}}'
# Take a snapshotcurl -X POST ".../api/v4/vm_actions" \ -d '{"vm": 42, "action": "snapshot", "params": {"name": "pre-upgrade"}}'
# Power off gracefullycurl -X POST ".../api/v4/vm_actions" \ -d '{"vm": 42, "action": "poweroff"}'The yb-api script is a built-in command-line wrapper available on every VergeOS node via SSH. It simplifies making API calls without having to construct full curl commands.
yb-api --get|--post|--put|--delete [options] /v4/<endpoint>| Flag | Purpose |
|---|---|
--get | Retrieve resources |
--post='JSON' | Create a resource with JSON payload |
--put='JSON' | Update a resource with JSON payload |
--delete | Delete a resource |
--server=IP | Target a specific VergeOS system |
--user=NAME | Authenticate as a specific user |
--fields='...' | Select fields to return |
--filter='...' | OData filter expression |
# List all VMs (excluding snapshots) with statusyb-api --get --user=admin --server=10.0.0.100 \ --fields='name,$key,ram,machine#status#status as machine_status' \ --filter='is_snapshot eq false' /v4/vms
# Get detailed VM info including drives and NICsyb-api --get --fields='most,machine[most,drives[most],nics[most]]' /v4/vms/1
# Create a new VMyb-api --post='{"name":"api-vm","enabled":true,"os_family":"linux", "cpu_cores":4,"ram":"8192"}' --user=admin --server=10.0.0.100 /v4/vms
# Rename a VMyb-api --put='{"name":"new-name"}' --user=admin --server=10.0.0.100 /v4/vms/1
# Power on a VMyb-api --post='{"vm":1, "action": "poweron"}' /v4/vm_actions
# Get table schema for VMsyb-api --get '/v4/vms/$table'The vrg command-line tool provides a full-featured remote management interface for VergeOS, built in Python with over 200 commands covering VMs, networks, storage, tenants, and system administration.
# macOS (Homebrew)brew install verge-io/tap/vrg
# Linux / Windows (pip or pipx)pip install vrgVM Management
Create, list, start, stop, snapshot, clone, and delete virtual machines with simple commands.
Network Operations
Manage virtual networks, firewall rules, DHCP settings, and VPN configurations.
Storage Control
Administer NAS volumes, CIFS/NFS shares, and monitor vSAN tiers.
Tenant Management
Provision tenants, allocate resources, and manage multi-tenant environments.
The vrg CLI wraps the same REST API documented above, providing tab completion, formatted output, and a more ergonomic interface for day-to-day operations from your workstation.
When API calls fail, VergeOS returns standard HTTP status codes with descriptive JSON error bodies:
| Status Code | Meaning | Common Cause |
|---|---|---|
| 401 | Unauthorized | Invalid credentials or expired token |
| 403 | Forbidden | Insufficient permissions for the operation |
| 404 | Not Found | Resource does not exist or invalid endpoint |
| 409 | Conflict | Resource state conflict (e.g., VM already running) |
| 422 | Validation Error | Invalid parameters or missing required fields |
| 429 | Rate Limited | Exceeded 1,000 requests/hour limit |
| 500 | Server Error | Internal error — check system logs |
fields=name,$key,ram) instead of fields=most to reduce payload sizelimit and offset for large result setsmachine_status for completion/$table) to discover available fields before writing automationNow that you understand the raw API, the following pages cover higher-level tools that wrap this API into language-native interfaces: