Skip to content

GET /api/vms

Updated

List the classic VMs known to this Lite host. AppVMs are exposed by GET /api/appvm/vms, not by this collection. API-key responses redact sensitive cloud-init fields.

The response is a pagination envelope (items + page metadata), and the collection accepts query parameters for paging and filtering. Items are ordered newest-first (created_at descending, id as tiebreaker) so pages are stable.

PropertyValue
Scoperead
Request bodynone
Success200 OK

Endpoint

GET ${baseUrl}/api/vms
read

List classic VMs and in-progress classic VM provisions.

Use your host URL and API key as shell variables:

baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"

cURL template

curl --request GET "${baseUrl}/api/vms" \
  --header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
LocationNameTypeRequiredDescription
HeaderAuthorizationbearer tokenyesBearer ${VIRT_AGENT_API_KEY}.
Querypageintegerno1-based page number. Defaults to 1; a page past the end returns an empty items.
Queryper_pageintegernoItems per page. Defaults to 50, clamped to 1200.
QuerystatestringnoComma-separated states to include, e.g. running,stopped. Matches either the display state or the underlying lifecycle state, so running also returns VMs still booting.
QueryqstringnoCase-insensitive substring match over id, discovered IPv4, and hostname.
Querynetwork_idstringnoOnly VMs attached to this VM network id.

Returns a pagination envelope whose items are classic VmView objects. items can also include a classic VM provision while image download or creation is in progress.

FieldTypeDescription
itemsVmView[]The VMs on this page (see schema below).
pageintegerEchoed 1-based page number.
per_pageintegerEffective page size after clamping.
totalintegerTotal VMs matching the filters, across all pages.
total_pagesintegerNumber of pages at this per_page (0 when total is 0).

Fields marked optional are omitted from the JSON object when they have no value. Fields marked nullable are always present and use null when they do not apply.

VmView

FieldTypePresenceDescription
idstringalwaysVM id.
statestringalwaysStored lifecycle state: created, running, paused, stopped, or failed.
display_statestringalwaysUser-facing state. In addition to lifecycle states, classic VM provisioning can report booting, downloading, creating, or provision_failed.
vcpusintegeralwaysAssigned vCPU count.
memory_mbintegeralwaysAssigned memory in MiB.
kernel_pathstring or nullnullablePVH kernel path when direct kernel boot is used.
firmware_pathstring or nullnullableFirmware path when firmware boot is used.
disk_pathstringalwaysRoot disk path on the Lite host. An in-progress classic provision returns an empty string until the disk exists.
volumesarray of VmVolumealwaysAttached data volumes, in disk order. The item shape is documented below.
seed_diskSeedDiskoptionalThe host-generated cloud-init seed disk. Present only on a VM with cloud_init. It is not a data volume and cannot be detached, but it does occupy a guest device letter.
cmdlinestringalwaysKernel command line.
console_socket_pathstringalwaysHost serial-console socket path. An in-progress classic provision returns an empty string.
failure_reasonFailureReasonoptionalHuman-readable and machine-readable failure details.
pidintegeroptionalCloud Hypervisor process id when known.
netsarray of VmNetworkalwaysNetwork interfaces in order: index 0 is the guest's eth0. Empty array when the VM has no interface.
platformVmPlatformoptionalSMBIOS platform values.
diskVmDiskoptionalAgent-managed root disk metadata.
imageVmImageoptionalClassic VM source image identity.
cloud_initCloudInitViewoptionalClassic VM cloud-init view. API-key responses omit cloud_init.password.
io_limitDiskIoLimitoptionalRoot-disk throughput ceiling. Omitted when the disk is unthrottled.
nestedbooleanoptionalWhether the guest may itself run KVM. Omitted when never set explicitly, which means the hypervisor default applies.
cpu_affinityarray of integersoptionalHost logical CPUs the vCPUs are pinned to. Omitted when unpinned.
cpu_topologyCpuTopologyoptionalGuest-visible CPU topology. Omitted when the hypervisor default applies.
pci_devicesarray of stringsalwaysPassed-through host PCI devices, as full BDF strings such as 0000:07:00.0. Empty array when nothing is passed through.
balloon_mbintegeroptionalMemory reclaim target in MiB. Omitted when no memory is being reclaimed.
created_atRFC 3339 stringoptionalCreation timestamp.
discovered_ipv4stringoptionalObserved guest IPv4 address.
guest_panicked_atRFC 3339 stringoptionalWhen a guest kernel panic was observed over pvpanic. state stays running: the hypervisor is alive and the guest is not.
shutting_downbooleanoptionalPresent as true while ACPI shutdown is pending; omitted when false.
modestringalwaysAlways vm on this endpoint.

volumes[] (VmVolume)

FieldTypePresenceDescription
idstringalwaysStable per-VM volume id, such as data0.
pathstringalwaysVolume file path on the Lite host.
virtual_size_bytesintegeralwaysVirtual size visible to the guest, in bytes.
fmtstringalwaysVolume image format. Currently qcow2.
readonlybooleanalwaysWhether the volume is attached read-only.
ownedbooleanalwaysWhether the agent owns and manages the volume file. true means deleting the VM erases it.
volume_idstringoptionalId of the matching first-class volume, whose lifetime is independent of this VM. Omitted for a VM-owned disk.
devicestringalwaysGuest block device, such as /dev/vdc. Derived from disk order, so detaching an earlier disk shifts this one down a letter. Mount by UUID or label in the guest, never by device letter.
disk_bytesintegeroptionalBytes the volume file actually occupies, which is smaller than virtual_size_bytes for a sparse image. Only the single-VM read fills this in; list responses omit it rather than pay a stat per row.

seed_disk (SeedDisk)

FieldTypePresenceDescription
devicestringalwaysGuest block device holding the cloud-init seed. It sits directly after the root disk, so data volumes on a cloud-init VM start one letter later than on a VM without one.
size_bytesintegeralwaysSize the guest sees. Fixed, and small: the seed holds only the rendered cloud-init files.

io_limit (DiskIoLimit)

FieldTypePresenceDescription
bps_totalintegeroptionalCombined read and write ceiling in bytes per second. Omitted when unlimited.
iops_totalintegeroptionalCombined read and write ceiling in IO operations per second. Omitted when unlimited.

cpu_topology (CpuTopology)

FieldTypePresenceDescription
socketsintegeralwaysGuest-visible socket count.
coresintegeralwaysCores per socket.
threadsintegeralwaysThreads per core. sockets × cores × threads always equals vcpus.

failure_reason (FailureReason)

FieldTypePresenceDescription
detected_atRFC 3339 stringalwaysTime the failure was detected.
summarystringalwaysOne-line operator-readable explanation.
detailobjectalwaysTagged machine-readable detail. kind is one of socket_gone, socket_dead, ping_timeout, process_exit, process_signal, missing_pid, disk_missing, invalid_vm_id, boot_timeout, or provision_failed.
detail.kindstringalwaysFailure-detail discriminator.
detail.codeintegerconditionalProcess exit code when kind is process_exit.
detail.signumintegerconditionalSignal number when kind is process_signal.
detail.pathstringconditionalMissing disk path when kind is disk_missing.
detail.idstringconditionalInvalid VM id when kind is invalid_vm_id.
detail.secondsintegerconditionalTimeout duration when kind is boot_timeout.
causestringalwaysHigher-level cause: operator_shutdown, guest_shutdown, ch_crash, vmm_hang, disk_missing, boot_timeout, provision_failed, record_invalid, or unknown.

nets[] (VmNetwork)

FieldTypePresenceDescription
modestringalwaysNetwork mode. Currently bridge.
bridgestringalwaysHost bridge interface.
tap_namestringalwaysAgent-created tap interface.
macstringalwaysGuest MAC address.
network_idstringoptionalHost network id.
vlan_tagintegeroptional802.1Q VLAN tag.
ipv4VmNetworkIpConfigoptionalIPv4 assignment metadata.
ipv6VmNetworkIpConfigoptionalIPv6 assignment metadata.
mtuintegeroptionalInterface MTU.
isolatedbooleanoptionalPer-VM bridge port-isolation override.
spoof_guardbooleanoptionalPer-VM anti-spoof override.
rate_limit_mbpsintegeroptionalSymmetric network rate limit in Mbps.
allowed_ipsarray of stringsoptionalExtra source addresses or CIDRs anti-spoof lets through, beyond the interface's own address. Omitted when empty.
dhcp_snooped_ipv4stringoptionalGuest IPv4 learned from the upstream DHCP ACK. Authoritative, and the preferred source for discovered_ipv4. Only set on an interface with no static ipv4.
last_observed_ipv4stringoptionalLast IPv4 seen for this MAC in the host neighbor table. Guest-asserted, so it is a display fallback only, and it survives ARP expiry.

nets[].ipv4 / nets[].ipv6 (VmNetworkIpConfig)

FieldTypePresenceDescription
addressstringalwaysCIDR address.
gatewaystringoptionalGateway address without a CIDR suffix.
dns_serversarray of stringsoptionalDNS server addresses.

platform (VmPlatform)

FieldTypePresenceDescription
serial_numberstringoptionalSMBIOS serial number.

disk (VmDisk)

FieldTypePresenceDescription
modestringalwaysRoot disk mode. Currently copy.
base_pathstringalwaysCanonical source image path.
virtual_size_bytesintegeralwaysVirtual size visible to the guest, in bytes.
ownedbooleanalwaysWhether the agent owns and manages the root disk file.
image_fmtstringoptionalRoot disk image format. Currently qcow2.
qsd_pidintegeroptionalStorage process id.
qsd_start_timeintegeroptionalStorage process start time in boot-relative clock ticks.
qsd_blk_socketstringoptionalRoot-disk block socket path.
qsd_qmp_socketstringoptionalStorage control socket path.
runtimeVolumeRefoptionalBackend-independent runtime identity.

disk.runtime (VolumeRef)

FieldTypePresenceDescription
backendstringalwaysStorage backend. Currently qsd.
pidintegeralwaysStorage process id.
start_timeintegeralwaysStorage process start time in boot-relative clock ticks.
blk_socketstringalwaysRoot-disk block socket path.
qmp_socketstringalwaysStorage control socket path.

image (VmImage)

FieldTypePresenceDescription
image_idstringalwaysSource image id.
distrostringoptionalDistribution name.
versionstringoptionalDistribution version.

cloud_init (CloudInitView)

FieldTypePresenceDescription
hostnamestringalwaysGuest hostname.
userstringalwaysGuest account configured by cloud-init.
ssh_authorized_keysarray of stringsalwaysSSH public keys.
passwordstringoptionalGuest password. This field is always omitted from API-key responses.
networkCloudInitNetworkoptionalRendered static guest network input.
instance_idstringalwaysNoCloud instance identity.
console_autologinbooleanalwaysWhether serial-console auto-login is enabled.
sudobooleanalwaysWhether a non-root cloud-init user receives sudo access.

cloud_init.network (CloudInitNetwork)

FieldTypePresenceDescription
ipv4CloudInitIpConfigalwaysStatic IPv4 configuration.
ipv6CloudInitIpConfigoptionalStatic IPv6 configuration.

cloud_init.network.ipv4 / ipv6

FieldTypePresenceDescription
addressstringalwaysCIDR address.
gatewaystringoptionalGateway address without a CIDR suffix.
dnsarray of stringsoptionalDNS server addresses. This field is named dns, not dns_servers.
Terminal window
baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"
# First page of running VMs, 50 per page.
curl "${baseUrl}/api/vms?page=1&per_page=50&state=running" \
--header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
{
"items": [
{
"id": "demo-api-vm",
"state": "running",
"display_state": "running",
"vcpus": 2,
"memory_mb": 2048,
"kernel_path": null,
"firmware_path": "/usr/share/virtainer/CLOUDHV.fd",
"disk_path": "/var/lib/virtainer/vms/demo-api-vm/root.qcow2",
"volumes": [],
"cmdline": "",
"console_socket_path": "/run/virtainer/demo-api-vm/console.sock",
"nets": [
{
"mode": "bridge",
"bridge": "vmbr0",
"tap_name": "vtdemoapi0",
"mac": "02:00:00:12:34:56",
"network_id": "default"
}
],
"pci_devices": [],
"image": {
"image_id": "debian-13-x86_64",
"distro": "debian",
"version": "13"
},
"mode": "vm"
}
],
"page": 1,
"per_page": 50,
"total": 1,
"total_pages": 1
}
StatusCodeDescription
401UNAUTHORIZEDAPI key is missing or invalid.
403FORBIDDENAPI key is valid but not allowed to access the endpoint.