Operations of the vms tag of the native REST API.
Virtual machine lifecycle (long-running operations)
POST /v1/guest-agent/offer
Whether to offer installing the guest agent for a VM created from template.
The Ubuntu and Debian cloud images do not ship qemu-guest-agent; a VM created from them has no tools status, no guest addresses from the agent and no quiesced snapshots until the package is installed. This says when to offer the installation and what it adds; nothing changes until the create request sets guestAgent: true (or the caller puts the returned vendorData into its own guestinfo.vendordata).
- CLI
kyvernon vm guest-agent-offer <template>
Request body
application/json: GuestAgentOfferRequest
| Name | Type | Required | Description |
|---|
extraConfig | object | | The VM's extraConfig so far (guestinfo.userdata and friends). |
|---|
template | string | yes | The template, image or guest OS the VM is created from (Ubuntu 24.04 LTS, debian-13, ubuntu64Guest). |
|---|
Responses
POST /v1/vms
Creates a VM in a folder.
- CLI
kyvernon vm create --folder <id> --spec <file>
Request body
application/json: CreateVmRequest
| Name | Type | Required | Description |
|---|
createDisks | array of DiskFileRequest | | Disk files the task creates before the VM record exists: empty qcow2 images, or copies or linked clones of an image (sourcePath). Each must be one of the disks of spec.config.disks (same datastore and path). |
|---|
folderId | string | yes | VM folder id (group-vN). |
|---|
guestAgent | boolean | | Install the guest agent through cloud-init: merges packages: [qemu-guest-agent] and runcmd: [systemctl enable --now qemu-guest-agent] into guestinfo.vendordata (kyvernon_vm_model::guestinfo::with_guest_agent). For images that lack the package (the Ubuntu and Debian cloud images); without it such a VM reports toolsNotInstalled. Never applied unless set: POST /v1/guest-agent/offer says when to offer it. Vendor data that is not #cloud-config is refused, not rewritten. |
|---|
host | string or null | | Host to place the VM on (host-N). Without it the VM goes to the first connected host of the resource pool's cluster. |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
spec | VirtualMachine | yes | Body in the VirtualMachine schema, validated as a record (name, instance_uuid, resource_pool and config are required). |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
POST /v1/vms/register
Registers an existing VM from a datastore path (POST /v1/vms/register, SOAP Folder.RegisterVM_Task). Restores inventory from .kyvernon-vm.json without recreating disks.
- CLI
kyvernon vm register --folder <id> --path <path> [--resource-pool <id>]
Request body
application/json: RegisterVmRequest
| Name | Type | Required | Description |
|---|
asTemplate | boolean | | Register as a template. |
|---|
folderId | string | yes | Destination VM folder (group-vN). |
|---|
host | string or null | | Host (host-N). Optional placement hint. |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
name | string or null | | Display name; defaults to the name in the on-disk manifest. |
|---|
path | string | yes | Datastore path ([ds] name/name.vmx or [ds] name/.kyvernon-vm.json). |
|---|
resourcePool | string or null | | Resource pool (resgroup-N). Required unless asTemplate is true. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
DELETE /v1/vms/{id}
Deletes a powered-off VM.
- CLI
kyvernon vm delete <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/clone
Clones a virtual machine (full or linked).
- CLI
kyvernon vm clone <id> --name <name>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: CloneVmRequest
| Name | Type | Required | Description |
|---|
copyFirewall | boolean | | Copy the source's firewall: vNIC mode and profile, static group memberships, the rules of its own policy (same tenant only; Kyvernon.Firewall.ManagePolicies on the source). Without it the clone's vNICs start like new ones. |
|---|
copyTags | boolean | | Attach the source's tags to the clone (same tenant only; InventoryService.Tagging.AttachTag on the source). |
|---|
datastore | string or null | | Target datastore for every disk. Defaults to each disk's current datastore. Linked clones require the same datastore as the source disks. |
|---|
folderId | string or null | | Destination VM folder (group-vN). Defaults to the source's folder. |
|---|
host | string or null | | Host (host-N). Defaults to the source's host. |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
linked | boolean | | Linked clone (qcow2 child of a snapshot). Requires snapshot. |
|---|
name | string | yes | Name of the clone. |
|---|
powerOn | boolean | | Power the clone on after creation. |
|---|
resourcePool | string or null | | Resource pool (resgroup-N). Defaults to the source's pool. |
|---|
snapshot | integer (int32) or null | | Snapshot key to clone from (required when linked is true). |
|---|
template | boolean | | Mark the clone as a template. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
GET /v1/vms/{id}/console/screenshot
The current frame of the VM's graphical console as a PNG (the summary thumbnail).
- CLI
kyvernon vm console screenshot <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
maxWidth | query | integer (int32) or null | | Widest image wanted in pixels (1..=1920); the host scales down by an integer factor. Absent: the guest's resolution. |
|---|
Responses
| Status | Description | Schema |
|---|
| 200 | OK | array of integer (int32) |
|---|
| 403 | Permission denied; args.privilege names the missing privilege | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | error.console.powered_off, error.console.not_available (the VM has no graphical console), error.vm_not_placed | ErrorBody |
|---|
POST /v1/vms/{id}/console/ticket
Issues a single-use console ticket (30 s) for the VM. The caller then opens the WebSocket at websocketPath on the same origin; the stream carries RFB (VNC) bytes in binary frames, which noVNC speaks directly.
- CLI
kyvernon vm console ticket <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Responses
POST /v1/vms/{id}/customize
Applies a named customization specification to a powered-off VM (POST /v1/vms/{id}/customize, SOAP CustomizeVM_Task).
Linux / cloud-init specs merge guestinfo.* via a reconfigure task; Windows specs submit offline virt-customize with the rendered unattend answer file.
- CLI
kyvernon vm customize <id> --spec <name>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: CustomizeVmRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
spec | string | yes | Name of a catalogue specification (GET /v1/customization/specs/{name}). |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/mark-as-template
Marks a powered-off VM as a template (POST /v1/vms/{id}/mark-as-template).
- CLI
kyvernon vm mark-as-template <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Responses
| Status | Description | Schema |
|---|
| 204 | Done; no body | |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 409 | Conflict: the object exists, or expectedVersion is stale | ErrorBody |
|---|
POST /v1/vms/{id}/mark-as-vm
Converts a template back to a VM (POST /v1/vms/{id}/mark-as-vm).
- CLI
kyvernon vm mark-as-vm <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: MarkAsVmRequest
| Name | Type | Required | Description |
|---|
host | string or null | | Host (host-N). Defaults to the template's current host. |
|---|
resourcePool | string or null | | Resource pool (resgroup-N). Defaults to the template's current pool. |
|---|
Responses
| Status | Description | Schema |
|---|
| 204 | Done; no body | |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 409 | Conflict: the object exists, or expectedVersion is stale | ErrorBody |
|---|
POST /v1/vms/{id}/power-off
Powers a VM off hard, at once: the guest is not asked. A VM that is already off stays off and the task succeeds. Use shutdown to let the guest shut down first.
- CLI
kyvernon vm power-off <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: PowerRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/power-on
Powers a VM on.
- CLI
kyvernon vm power-on <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: PowerRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
Changes the VM configuration. The body carries the whole configuration as read from GET /v1/vms/{id} with the changes made in it; config.change_version names that read. Requests made from the same read are merged (each adds its own disk or network adapter); a request made from a read that is no longer known answers 409 error.vm.concurrent_modification. Device counts, host capacity, datastore space and disk shrink are checked by the task (error.vm.too_many_devices, error.vm.exceeds_host_cpu, error.vm.exceeds_host_memory, error.datastore.insufficient_space, error.disk.shrink_not_supported).
- CLI
kyvernon vm reconfigure <id> --config <file>
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: ReconfigureVmRequest
| Name | Type | Required | Description |
|---|
config | VmConfig | yes | Body in the VmConfig schema (the full desired configuration). |
|---|
createDisks | array of DiskFileRequest | | Disk files to create for disks config adds (empty images or from an image). |
|---|
deleteDisks | array of DiskFileRequest | | Disk files to delete after they leave config.disks (detach and destroy). Omit a removed disk here to detach and keep the file on the datastore. |
|---|
growDisks | array of DiskFileRequest | | Disks of config whose capacity grows: the file is grown to sizeBytes. On a running VM the host grows it online where the runtime can; otherwise the change applies at the next start (the task result says which). |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
name | string or null | | New display name (unique within the folder). |
|---|
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
POST /v1/vms/{id}/relocate
Relocates a VM (POST /v1/vms/{id}/relocate, SOAP RelocateVM_Task).
Cold storage relocate via datastore and/or per-disk disks requires a powered-off VM without snapshots; nics rebinds Ethernet network backing (SOAP deviceChange Edit). Host / pool / folder placement uses the same migrate task path.
- CLI
kyvernon vm relocate <id> [--host <id>] [--resource-pool <id>] [--folder <id>] [--datastore <id>] [--disk KEY=DATASTORE]... [--nic KEY=NETWORK]...
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: RelocateVmRequest
| Name | Type | Required | Description |
|---|
datastore | string or null | | Destination datastore (datastore-N) for every disk not listed in disks. |
|---|
disks | array of RelocateDiskLocator | | Per-disk locators (diskKey + datastore). Overrides datastore for those keys. |
|---|
folderId | string or null | | Destination VM folder (group-vN). |
|---|
host | string or null | | Destination host (host-N). Optional; pool placement may choose one. |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
nics | array of RelocateNicChange | | Ethernet network rebinds (nicKey + network). SOAP deviceChange Edit. |
|---|
resourcePool | string or null | | Destination resource pool (resgroup-N). |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/reset
Resets a running VM.
- CLI
kyvernon vm reset <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: PowerRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/resolve-migration
Resolves a VM fenced after a live migration with an unknown outcome (POST /v1/vms/{id}/resolve-migration, AgentOps resolve-migration).
The caller must have checked the destination. source-keeps resumes the source; destination-keeps removes the source instance and moves inventory placement to host. Never resume both.
- CLI
kyvernon vm resolve-migration <id> --resolution <source-keeps|destination-keeps> [--host <id>]
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: ResolveMigrationRequest
| Name | Type | Required | Description |
|---|
host | string or null | | Destination host (host-N). Required when resolution is destination-keeps so inventory placement moves off the source. |
|---|
resolution | FenceResolutionView | yes | Who keeps the guest (source-keeps or destination-keeps). |
|---|
Responses
GET /v1/vms/{id}/serial-log
Reads the tail of the VM's serial console log from the host.
- CLI
kyvernon vm serial-log <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
maxBytes | query | integer (int64) or null | | Maximum bytes from the end of the log (default 65536, maximum 1048576). |
|---|
Responses
POST /v1/vms/{id}/shutdown
Shuts a VM down gracefully: the guest is asked to power off (guest agent, then the ACPI power button); when it has not gone down after timeoutSeconds (default 90) the VM is powered off hard. A guest that takes its time holds up no other virtual machine. A VM that is already off stays off and the task succeeds.
- CLI
kyvernon vm shutdown <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: ShutdownRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
timeoutSeconds | integer (int64) or null | | How long the guest gets to shut down before the VM is powered off hard (seconds, 1 to 3600; default 90). |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
POST /v1/vms/{id}/snapshots
Creates a snapshot of a VM.
- CLI
kyvernon vm snapshot create <id> --name <name>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: CreateSnapshotRequest
| Name | Type | Required | Description |
|---|
description | string or null | | Free-text description. |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
memory | boolean | | Capture memory when the guest is powered on (resume on revert). |
|---|
name | string | yes | Display name (1..=80 characters). |
|---|
quiesce | boolean | | Quiesce guest file systems when a guest agent is present. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
DELETE /v1/vms/{id}/snapshots
Removes every snapshot of a VM.
- CLI
kyvernon vm snapshot remove-all <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
DELETE /v1/vms/{id}/snapshots/{key}
Removes one snapshot (removeChildren query removes the subtree).
- CLI
kyvernon vm snapshot remove <id> <key>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
key | path | integer (int32) | yes | Key of the snapshot in the snapshot tree |
|---|
removeChildren | query | boolean | | Also remove child snapshots |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
POST /v1/vms/{id}/snapshots/{key}/rename
Renames a snapshot (POST /v1/vms/{id}/snapshots/{key}/rename, SOAP VirtualMachineSnapshot.RenameSnapshot). Synchronous; at least one of name or description is required.
- CLI
kyvernon vm snapshot rename <id> <key> --name <name>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
key | path | integer (int32) | yes | Key of the snapshot in the snapshot tree |
|---|
Request body
application/json: RenameSnapshotRequest
| Name | Type | Required | Description |
|---|
description | string or null | | New free-text description (empty string clears it). |
|---|
name | string or null | | New display name (1..=80 characters, no surrounding spaces). |
|---|
Responses
| Status | Description | Schema |
|---|
| 204 | Done; no body | |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
POST /v1/vms/{id}/snapshots/{key}/revert
Reverts a VM to a snapshot.
- CLI
kyvernon vm snapshot revert <id> <key>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
key | path | integer (int32) | yes | Key of the snapshot in the snapshot tree |
|---|
Request body
application/json: RevertSnapshotRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
suppressPowerOn | boolean | | Do not power the guest on after a memory snapshot revert. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
POST /v1/vms/{id}/suspend
Suspends a running VM.
- CLI
kyvernon vm suspend <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Request body
application/json: PowerRequest
| Name | Type | Required | Description |
|---|
idempotencyKey | string or null | | Idempotency key. |
|---|
Responses
| Status | Description | Schema |
|---|
| 202 | Accepted: the body names the task to poll (GET /v1/tasks/{id}/wait) | TaskRef |
|---|
| 404 | Not found (or not visible to the caller) | ErrorBody |
|---|
| 412 | Failed precondition; the error body says which | ErrorBody |
|---|
POST /v1/vms/{id}/unregister
Removes a powered-off VM from inventory without deleting its disk files (POST /v1/vms/{id}/unregister). Writes [ds] name/.kyvernon-vm.json when datastore files are reachable so SOAP RegisterVM_Task / native register can restore it.
- CLI
kyvernon vm unregister <id>
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string | yes | Id of the virtual machine (vm-N) |
|---|
Responses
| Status | Description | Schema |
|---|
| 204 | Done; no body | |
|---|
| 400 | Invalid argument; the error body names the field | ErrorBody |
|---|
| 409 | Conflict: the object exists, or expectedVersion is stale | ErrorBody |
|---|
Version 0.1.