Get Virtualizor

Create VPS

The Create VPS API allows you to create virtual private servers on your server. A Virtual Private Server is an instance of your physical server that appears to the user as a dedicated server. Virtualizor supports OpenVZ, Xen PV, Xen HVM, XenServer, Linux KVM, LXC, Proxmox, Virtuozzo and OpenVZ 7 virtualization. You can specify all the configurations like the virtualization type, size, RAM etc that you want for the VPS.

The storage uuid needed for VPS creation can be obtained from the List Storage API.

The API response will contain "vpsinfo" as the details of the newly created VPS on success.

HTTP Request

https://hostname:4085/index.php?act=addvs

Parameters

NameMethodValueDescriptionRequired
actGETaddvsThe action specified to retrieve data after adding the vpsYes
virtPOSTtextThe Virtualization Technology has to be specified here, refer below table for valid valuesYes
node_selectPOSTIntIn order to select slave server or when you to want auto-select the server.Yes
user_emailPOSTtextAdd User EmailYes
user_passPOSTtextAdd a passwordYes
hostnamePOSTtextThe hostname the VPSYes
rootpassPOSTtextThe root password for the VPSYes
slave_serverPOSTIntThe slave server ID on which vps is to be createdNo
server_groupPOSTIntServer Group ID. If provided VM will be created among any server which belong to this server group. NOTE: If slave_server is provided, server_group will be ignored.No
osidPOSTIntThe ID of the Operating SystemYes
ipsPOSTarrayThe IP Address(s) for the VPSYes
spacePOSTarrayThe disk space for the VPS. In case of Multiple Disk you can specify the array as given in the example. Otherwise just value for single disk VPS is enough you can find st_uuid and stid on List storage pageYes
bus_driverPOSTtextProvide bus driver for proxmox QEMU/KVMRequired for Proxmox KVM
bus_driver_numPOSTIntProvide bus driver numbers ranging from 0-5Required for Proxmox KVM
ramPOSTIntThe ram value in MBs for the VPSYes
bandwidthPOSTIntThe network bandwidth for the VPS: 0 (Zero) for unlimitedYes
speed_cap_upPOSTIntThe capped upload speed, (you will need to provide bandwidth for capped feature to work), Also the Capped speed should be less than or equal to Network/Upload (If provided) speed.
speed_cap_downPOSTIntThe capped download speed, (you will need to provide bandwidth for capped feature to work), Also the Capped speed should be less than or equal to Network/Upload (If provided) speed.
coresPOSTIntThe number of cores allotted to the VPSYes
plidPOSTIntThe plan ID for the VPSNo
network_speedPOSTIntThe network_speed for the VPS in KB/sNo
mgsPOSTIntMedia groups IDsNo
priorityPOSTIntThe IO priority for the VPS (Only for Virtuozzo OpenVZ and Virtuozzo KVM)No
cpuPOSTIntThe CPU weight for the VPSNo
burstPOSTIntThe burst RAM for the VPS (Only for OpenVZ and Proxmox)No
cpu_percentPOSTIntThe CPU Percent time for the VPS (Only for OpenVZ and Proxmox)No
isoPOSTtextThe ISO nameNo
stidPOSTIntStorage ID on which the VPS is to be created. (Not needed if using Primary storage)No
vncPOSTIntFlag to enable vnc(0 or 1) (Only for KVM and Xen)No
vncpassPOSTtextThe vnc password (Only for KVM and Xen)No
swapramPOSTIntThe amount of SWAP for the VPS (Only for KVM, Xen, Proxmox KVM and XCP)No
shadowPOSTIntThe amount of shadow memory for the VPS (Only Xen HVM)No
hvmPOSTIntFlag to enable hvm(0 or 1)(Only for Xen HVM)No
bootPOSTtextThe boot order (dca or cda) (Only for KVM and Xen HVM)No
num_ipsPOSTIntThe Number of Ipv4 Address given to the vpsNo
num_ips6POSTIntThe Number of Ipv6 Address given to the vpsNo
num_ips6_subnetPOSTIntThe Number of IPV6 Subnet to be assigned to the vpsNo
noemailPOSTIntFlag to disable email notification to VPS client only (0 or 1)No
fnamePOSTtextAdd user first nameNo
lnamePOSTtextAdd user last nameNo
uidPOSTIntSelects a unique ID of the user to which the vps will be assignedNo
dnsplidPOSTIntAdd a dns Plan to the vps. User which has selected dns plan only can use thisNo
addvpsPOST1If set the vps will be createdNo
band_suspendPOST1/0Flag to suspend the VPS networkNo
tuntapPOSTIntFlag to enable tuntap (0 or 1) (Only for OpenVZ/OpenVZ7)No
pppPOSTIntFlag to enable ppp (0 or 1) (Only for OpenVZ/OpenVZ7)No
fusePOSTIntFlag to enable fuse (0 or 1) (Only for OpenVZ/OpenVZ7)No
ipipPOSTIntFlag to enable ipip (0 or 1) (Only for OpenVZ/OpenVZ7)No
ipgrePOSTIntFlag to enable ipgre (0 or 1) (Only for OpenVZ/OpenVZ7)No
nfsPOSTIntFlag to enable nfs (0 or 1) (Only for OpenVZ/OpenVZ7)No
quotaugidlimitPOSTIntProvide quotaugidlimit (Only for OpenVZ/OpenVZ7)No
iolimitPOSTIntProvide iolimit (Only for OpenVZ/OpenVZ7)No
iopslimitPOSTIntProvide iopslimit (Only for OpenVZ/OpenVZ7)No
vif_typePOSTtextThe VIF type (netfront or ioemu) (Only for KVM and Xen HVM)No
nic_typePOSTtextThe NIC type (default or e1000) (Only for KVM and Xen)No
ips_intPOSTarraySet the internal ip for the vpsNo
virtioPOST1/0Flag to enable VIRTIO (0 or 1)(Only for KVM)No
kvm_cachePOSTtextThe type disk-cache mechanism can be writeback, writethrough, directsync or default (Only for KVM and Proxmox KVM)No
upload_speedPOSTIntThis will set the upload speed of the vps in KB/sNo
dnsPOSTarrayThis will assign the dns nameserver that the vps should useNo
control_panelPOSTtextThis option will install selected web control panel in the VPS types of control panel are cpanel/webuzo/plesk/webmin/inteworx/ispconfig/cwp/vestaNo
recipePOSTIntThis will execute the selected recipe after creation of VPSNo
cpupinPOSTarrayPin the particular CPU Cores to this VPS (Only for KVM, Virtuozzo KVM,Virtuozzo OpenVz, XEN)No
cpu_modePOSTtextRefer Values from below tableNo
topology_socketsPOSTIntSpecify the number of CPU Sockets to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_coresPOSTIntSpecify the number of CPU cores to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_threadsPOSTIntSpecify the number of CPU Threads to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
io_modePOSTtextSets the I/O policy for the VPS can be native/threads (Only for KVM)No
kvm_vgaPOST1/0Enables VGA for the VPS (Only for KVM)No
accelerationPOST1/0If VGA is enabled then this option will enable 2D and 3D acceleration will be for the VPSNo
disable_ebtablesPOST1/0Disable ebtables for the VPSNo
rdpPOST1/0Enable Remote Desktop Connection (For Windows VPS)No
vnc_keymapPOSTtextAllows to select keymap can be 'en-us', 'de-ch', 'ar', 'da', 'et', 'fo', 'fr-be', 'fr-ch', 'hu', 'it', 'lt', 'mk', 'nl', 'no', 'pt', 'ru', 'sv', 'tr', 'de', 'en-gb', 'es', 'fi', 'fr', 'fr-ca', 'hr', 'is', 'ja', 'lv', 'nl-be', 'pl', 'pt-br', 'sl', 'th'No
osreinstall_limitPOSTIntIf you want to limit the number of OS re-installs per month.Eg. 0 - is unlimitedNo
admin_managedPOST1/0If checked, VPS can not be managed from Enduser panelNo
disable_nw_configPOST1/0If checked, Virtualizor will not configure/re-write network when a VPS is rebooted. However, during creation of the VPS, the network file will be writtenNo
total_iops_secPOSTIntProvide total I/O per sec in MBs (For KVM only)No
read_bytes_secPOSTIntProvide read mega per sec in MBs (For KVM only)No
write_bytes_secPOSTIntProvide write mega per sec in MBs (For KVM only)No
haPOST1/0Provide 1 to enable HA in VM,
NOTE : HA will be enabled in VM only if the VM is created in HA enabled server group
No
os_typePOSTtextSetting the proper os_type allows Proxmox VE to optimize some low level parameters, Please refer following table for valid os_type values (For Proxmox kvm only) No
rtc POST 1/0If rtc is is set to1 then it is enabled else it is disabled (For Proxmox kvm only) No
unprivileged POST 1/0If set than container will be created as an unprivileged container Note: once container is created it cannot be changed to privileged and vice versa (For Proxmox lxc only)No
kvm_vgaPOSTIntAssign vga vram value in MB. By default virtualizor will assign 8MB. (For KVM only)No
ssd_emulationPOSTIntProvide 1 for to enable ssd_emulation. (For KVM and Promox kvm only)No
disable_passwordPOSTIntIf enabled then password authentication will be restricted for SSH.No
discardPOSTIntProvde 1 to enable disacrd option (Only for Promox KVM)
No
ssh_optionsPOSTIntProvide one of these ssh_options: add_ssh_keys,
generate_keys, use_ssh_keys, we have provided detailed information about these options below
No
sshkeyPOSTIntProvide public ssh key
No
private_keyPOSTIntProvide private key (compulsory if generate_keys is passed in ssh_options)
No
biosPOSTstringprovide bios seabios/uefi Default is seabios (KVM only)No
enable_tpmPOSTintTPM for UEFI pass 1 if enabled (KVM only)No
bootordPOSTstringComma seperated disk and cdrom (KVM o)No

Vertical scaling parameters (Since V3.1.3)

Note
  1. Vertical scaling is supported on KVM based virtualization only.
  2. QEMU version should be greater than or equal to 1.5, To check QEMU Version run "/usr/bin/virsh version"
  3. Vertical scaling is currently not supported on Windows VPS
NameMethod ValueDescriptionRequired
enable_ver_scaling Post 1/0 Pass 1 to enable vertical scaling, If you have already enabled scaling in master settings then no need to pass it No
ver_max_ram Post  int (MB) To set the maximum value for the VM. If provided then it will override the global setting value in master settings.
No
ver_ram_threshold Post int (%) To set the threshold to increase the RAM by value provided. If provided then it will override the global setting value in master settings.
No
ver_ram_inc_by Post int (GB) To increase the RAM after the threshold matches the value. If provided then it will override the global setting value in master settings.
No
ver_max_cpu Post int (Cores) To set the maximum value for the Cores.  If provided then it will override the global setting value in master settings.
No
ver_cpu_threshold
Post int (%) To set the threshold to increase the cores by value provided. If provided then it will override the global setting value in master settings. No
ver_cpu_inc_by
Post int (Core) To increase the Cores after the threshold matches the value. If provided then it will override the global setting value in master settings. No

ssh options

There are three types of ssh_options which are described below:

1. add_ssh_keys : Pass your own public ssh key in post to add that ssh key in your vps.
$post['sshkey'] = 'PUBLIC_KEY';

2. generate_keys : If you want to create new pair of keys then you will first need to generate using the following link:
https://www.virtualizor.com/docs/admin-api/generate-keys/

Once you have made the pair you will need to pass it to the ADDVS calls using following variables :
$post['sshkey'] = 'PUBLIC_KEY';
$post['private_key '] = 'PRIVATE_KEY';

3. use_ssh_keys :If you want to use existing key then first you will need to get list of sshkey using the following link:
https://www.virtualizor.com/docs/admin-api/list-ssh-keys/

Once you have made the pair you will need to pass it to the ADDVS calls using following variables :
$post[existing_key'][] = 'PUBLIC_KEY 1';
$post['existing_key '][] = 'PUBLIC_KEY 2';

Valid os_type values (For Proxmox kvm only)

ValuesDescription
otherunspecified OS / Default
wxpMicrosoft Windows XP
w2kMicrosoft Windows 2000
w2k3Microsoft Windows 2003
w2k8Microsoft Windows 2008
wvistaMicrosoft Windows Vista
win7Microsoft Windows 7
win8Microsoft Windows 8/2012/2012r2
win10Microsoft Windows 10/2016
l24Linux 2.4 Kernel
l26Linux 2.6 - 5.X Kernel
solarisSolaris/OpenSolaris/OpenIndiania kernel

Virtualization Type Values

(xen | xenhvm | xcp | xcphvm | openvz | kvm | lxc | vzo | vzk | proxo | proxk | proxl)

CPU Mode values for KVM

( host-model | host-passthrough )

CPU Mode values for Proxmox KVM

( host-model | host-passthrough | 486 | athlon | pentium | pentium2 | pentium3 | coreduo | core2duo | kvm32 | qemu32 | qemu64 | phenom | Conroe | Penryn | Nehalem | SandyBridge | IvyBridge | Haswell | Broadwell | Opteron_G1 | Opteron_G2 | Opteron_G3 | Opteron_G4 | Opteron_G5 )

Bus Drivers For Proxmox KVM

( sata | ide | virtio | scsi )

NOTE: The fields that are specified as required are the fields that are always required whether you create it from plans or without plan also the required filed may vary depending on virt

Sample Code For providing disk space in Proxmox KVM

<?php 
     $post['space'] = array(0=>array(
                            'size' => 2,
                            'st_uuid'=>'ngavdbegidnbme2d',
                            'bus_driver' => 'virtio',
                            'bus_driver_num' => 0),
                        1=>array(
                            'size'=>2,
                            'st_uuid'=>'ngavdbegidnbme2d',
                            'bus_driver' => 'virtio',
                            'bus_driver_num' => 1));
?>

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['serid'] = 0;
    $post['slave_server'] = 1; // Pass the slave server ID if you want to create VPS on the Slave Server
    $post['virt'] = 'kvm';
    $post['uid'] = 0;
    $post['user_email'] = 'test@test.com';
    $post['user_pass'] = 'test123';
    $post['fname'] = '';
    $post['lname'] = '';
    $post['plid'] = 0;
    $post['osid'] = 88;
    $post['hostname'] = 'test12345.com';
    $post['rootpass'] = 'test123';
    $post['ips'] = array('192.168.111.49');
    $post['num_ips6'] = 0;
    $post['num_ips6_subnet'] = 0;
    $post['stid'] = 1;
    $post['space'] = array(0=>array(
                            'size' => 2,
                            'st_uuid'=>'ngavdbegidnbme2d'),
                        1=>array(
                            'size'=>2,
                            'st_uuid'=>'ngavdbegidnbme2d')); //For VPS with Multi-Disk
    $post['ram'] = 1024;
    $post['swapram'] = 0;
    $post['bandwidth'] = 0;
    $post['network_speed'] = 0;
    $post['cpu'] = 1000;
    $post['cores'] = 4;
    $post['cpu_percent'] = 100.00;
    $post['vnc'] = 1;
    $post['vncpass'] = 'test123';
    $post['kvm_cache'] = 0;
    $post['io_mode'] = 0;
    $post['vnc_keymap'] = 'en-us';
    $post['nic_type'] = 'default';
    $post['osreinstall_limit'] = 0;
    $post['speed_cap_up'] = 64000;
// kb
    $post['speed_cap_down'] = 1280; //in kb
    $post['bootord'] = 'disk1,cdrom2,cdrom1';



    $output = $admin->addvs_v2($post);

    print_r(json_encode($output));
?>

Output

{
  "title": "Add Virtual Server",
  "error": [],
  "vs_info": {
    "uuid": "1iq2vt2ih9ankjuo",
    "pass": "test123",
    "plid": 0,
    "hostname": "test12345.com",
    "space": 4,
    "ram": 1024,
    "bandwidth": 0,
    "network_speed": 0,
    "upload_speed": -1,
    "cores": 4,
    "cpupin": -1,
    "uid": "58",
    "io": 0,
    "burst": 0,
    "cpu_percent": 100,
    "swap": 1024,
    "acpi": 1,
    "apic": 1,
    "pae": 1,
    "vnc": 1,
    "vncport": 0,
    "shadow": 0,
    "virt": "kvm",
    "hvm": 0,
    "iso": "",
    "boot": "cda",
    "band_suspend": 0,
    "speed_cap_down": 0,
    "speed_cap_up": 0,
    "tuntap": 0,
    "ppp": 0,
    "mac_status": 0,
    "osreinstall_limit": 0,
    "mg": [],
    "kvm_cache": "0",
    "io_mode": "0",
    "vnc_keymap": "en-us",
    "virtio": 0,
    "numa": 0,
    "cpu_mode": "",
    "admin_managed": 0,
    "rdp": 0,
    "disable_nw_config": 0,
    "topology_sockets": 0,
    "topology_cores": 0,
    "topology_threads": 0,
    "openvz_features": "",
    "bpid": 0,
    "install_xentools": 0,
    "sec_iso": "",
    "mac": "",
    "osid": 270,
    "cpu": 1000,
    "kvm_vga": 0,
    "acceleration": 0,
    "vncpass": "test123",
    "disable_ebtables": 0,
    "webuzo": 0,
    "nic_type": "default",
    "vif_type": "netfront",
    "vps_name": "v1004",
    "ubc": "",
    "vpsid": "46",
    "disks": [
      {
        "primary": 1,
        "path": "/dev/vg/vsv1004-drhuczo0bfzvsdmi-1iq2vt2ih9ankjuo",
        "st_uuid": "ngavdbegidnbme2d",
        "type": "block",
        "size": "2",
        "size_unit": "",
        "vpsid": "46",
        "rescue": 0,
        "target_name": "",
        "format": "raw",
        "disk_uuid": "drhuczo0bfzvsdmi",
        "num": 0
      },
      {
        "primary": 0,
        "path": "/dev/vg/vsv1004-dzvpdxvr1ozesum0-1iq2vt2ih9ankjuo",
        "st_uuid": "ngavdbegidnbme2d",
        "type": "block",
        "size": "2",
        "size_unit": "",
        "vpsid": "46",
        "rescue": 0,
        "target_name": "",
        "format": "raw",
        "disk_uuid": "dzvpdxvr1ozesum0",
        "num": 1
      }
    ],
    "ips": [
      "8.8.8.65"
    ],
    "ipv6": [],
    "ipv6_subnet": [],
    "ips_int": []
  },
  "globals": {
    "cookie_name": "SIMCookies7614"
  }
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list