Virtual Machine

Create virtual machines

Creates one or more virtual machines with the specified custom configuration and features provided in the request body. For more information about the virtual machine features offered by Hyperstack, see Custom VM features.

post/core/virtual-machines

Request

  • Base URL: https://infrahub-api.nexgencloud.com/v1
  • URL: https://infrahub-api.nexgencloud.com/v1/core/virtual-machines
  • Auth: API key in header api_key

Request body

countinteger required

The number of virtual machines to be created.

environment_namestring required

The name of the environment in which the virtual machine is to be created.

flavor_namestring required

The name of the GPU hardware configuration (flavor) for the virtual machines being created.

key_namestring required

The name of the existing SSH key pair to be used for secure access to the virtual machine. For additional information on SSH key pairs, see Key pair endpoints.

namestring required

The name of the virtual machine being created.

image_namestring

The operating system (OS) image name designated for installation on the virtual machine.It also accepts custom, private images, created from existing snapshots.

volume_namestring

The names of the volume(s) to be attached to the virtual machine being created.

create_bootable_volumeboolean

Indicates whether to create a bootable volume for the virtual machine. When set to true, a bootable volume will be created.

user_datastring

Optional initialization configuration commands to manage the configuration of a virtual machine at launch using cloud-init scripts. The value is Base64 encoded when it is submitted, and the encoded value must not exceed 65,535 bytes. For more information about custom VM configuration using cloud-init, see Initialization configuration.

callback_urlstring

An optional URL where actions performed on the virtual machine will be sent. For additional information on event callbacks, see Attach a callback to a VM.

assign_floating_ipboolean

When this field is set to true, it attaches a public IP address to the virtual machine, enabling internet accessibility.

enable_port_randomizationboolean

Indicates whether to enable port randomization.This setting is only effective if 'assign_floating_ip' is true.

labelsstring[]

Optional user-supplied tags for grouping or filtering.

Example request

{
  "security_rules": [
    {
      "protocol": "any"
    }
  ]
}

Response

Virtual machine(s) created successfully.

statusboolean

Whether the request succeeded.

messagestring

Human-readable description of the result.

Example response

{
  "status": true,
  "message": "VM is scheduled for creation.",
  "instances": [
    {
      "id": 1402,
      "name": "example-vm",
      "status": "CREATING",
      "environment": {
        "id": 9876,
        "name": "example-environment",
        "org_id": 7613,
        "region": "NORWAY-1",
        "features": {
          "green_status": "GREEN"
        }
      },
      "image": {
        "name": "Ubuntu Server 24.04 LTS (Noble Numbat)"
      },
      "flavor": {
        "id": 8429,
        "name": "n1-cpu-small",
        "cpu": 4,
        "ram": 4,
        "disk": 100
      },
      "os": "Ubuntu Server 24.04 LTS (Noble Numbat)",
      "keypair": {
        "name": "example-keypair"
      },
      "volume_attachments": [
        {
          "volume": {
            "id": 1402,
            "name": "example-volume",
            "description": "example",
            "volume_type": "Cloud-SSD",
            "size": 10
          },
          "status": "ATTACHING",
          "device": "/dev/disk/by-id/virtio-a66fd1a8-e198-4eb4-a",
          "created_at": "2026-05-06T16:04:09Z"
        }
      ],
      "security_rules": [
        {
          "id": 1129,
          "direction": "egress",
          "protocol": "any",
          "port_range_min": 1,
          "port_range_max": 65535,
          "ethertype": "IPv4",
          "remote_ip_prefix": "0.0.0.0/0",
          "status": "SUCCESS",
          "created_at": "2026-05-06T15:18:42Z"
        }
      ],
      "power_state": "NOSTATE",
      "vm_state": "building",
      "fixed_ip": "192.0.2.91",
      "floating_ip": "203.0.113.205",
      "floating_ip_status": "NO FLOATING IP",
      "port_randomization_status": "NO_FLOATING_IP",
      "port_randomization": true,
      "created_at": "2026-05-06T16:04:09Z"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.