Use Create VM API to create new VPS on your Cloud Admin account.
This function is for cloud user. You will need the API credentials to authenticate this request. Get your API credentials by following the guide: Get API Credentials
https://vm1.apivps.com:4083/index.php?act=create
Parameters | Type | Value | Description |
---|---|---|---|
act | GET | create | The action will create VPS instance for a particular user. |
virt | POST | virt | The virtualization to be specified relevant to which the VPS will be created. |
sgid | POST | Int | The server group where the VPS will created and assigned. |
rootpass | POST | rootpass | The root password that will be set for the VPS. |
hostname | POST | hostname | Hostname for the VPS will be set. |
space | POST | Int | This will set the disk space for the VPS. Also it will assign the disk space comparing with the space the individual user has declared. |
ram | POST | Int | This will set the RAM for the VPS. Also it will assign the RAM comparing with the RAM the individual user has declared. |
swapram | POST | Int | This will use the disk space to create swap. |
bandwidth | POST | Int | This will assign the bandwidth to the VPS and will also check available bandwidth that is assigned to the user. |
uid | POST | Int | The user id under whom the VPS will be created. |
cores | POST | Int | Number of CPU cores that will be used by the VPS. Assigned at the time of creation. |
ips | POST | Int | Number of IPv4 addresses that will be assigned to the VPS. |
ips_int | POST | Int | Number of internal IP addresses that will be assigned to the VPS. |
ipv6 | POST | Int | Number of IPv6 addresses that will be assigned to the VPS. |
ipv6_subnet | POST | Int | Number of IPv6 subnet that will be assigned to the VPS. |
vnc | POST | 1/0 | If set then VNC will be set for the VPS. |
vncpass | POST | vncpass | VNC password will be set automatically. |
iso | POST | iso | Create VPS using iso present on the server. |
boot | POST | boot | Sets the boot order in the VPS. |
band_suspend | POST | 1/0 | If set then VPS will be suspended if the bandwidth limit is exceeded. |
osreinstall_limit | POST | Int | This sets the value for limit for OS reinstallation. |
osid | POST | Int | This will assign the osid to the VPS for installing OS template. Get osid values here: https://radwebhosting.com/client_area/knowledgebase/246/List-of-Available-OS-Templates.html |
mg | POST | mg | If this is set then the OS template belonging to the media group will be displayed. |
nic | POST | string | Provide Virtual Network Interface Type. |
ssh_options | POST | Int | Provide one of these ssh_options: add_ssh_keys, generate_keys, use_ssh_keys, we have provided detailed information about these options below. |
sshkey | POST | Int | Provide public SSH key. |
private_key | POST | Int | Provide private key (compulsory if generate_keys is passed in ssh_options). |
existing_key | POST | array | Provide an array of public key (compulsory if use_ssh_keys is passed in ssh_options). |
bios | POST | String | Provide bios seabios/uefi (Default is seabios) will be applied only while booting with iso.(KVM ONLY). |
addvs | POST | 1 | If set then the VPS will be created. |
There are three types of ssh_options which are described below:
<?php require_once('/usr/local/virtualizor/sdk/enduser.php'); $key = 'your_api_key'; $pass = 'your_api_pass'; $ip = 'host_ip'; $admin = new Virtualizor_Enduser_API($ip, $key, $pass); $post = array(); $post['virt'] = 'kvm'; $post['sgid'] = 8; $post['rootpass'] ='Test123!!'; $post['hostname'] = 'testcloud' ; $post['space'] = 20 ; $post['ram'] = 1024; $post['swapram'] = 1024; $post['bandwidth'] = 1000; $post['uid'] = 372; $post['cores'] = 2; $post['ips'] = 1; $post['vnc'] = 1; $post['vncpass'] = 'testvnc'; $post['band_suspend'] = 1; $post['osreinstall_limit'] = 0; $post['osid'] = 955; $post['addvs'] = 1; $output = $admin->create($post); print_r(json_encode($output)); ?>
curl -k -X POST -d "addvs=1&virt=kvm&sgid=8&rootpass=Test123!!&hostname=testcloud&space=20&ram=1024&swap=1024&bandwidth=1000&uid=372&cpu=256&cores=8&ips=5&vnc=1&vncpass=testvnc&osid=955" -L "https://vm1.apivps.com:4083/index.php?act=create&api=json&apikey=your_api_key&apipass=your_api_pass"
{ "uid": "372", "act": "create", "timezone": 1, "timenow": "June 6, 2023, 2:09 am", "vpsid": "3588", "username": "test@test.com", "user_type": "2", "preferences": { "fname": "test", "lname": "test", "theme": "default", "language": "english", "timezone": 1 }, "url": "index.php?", "rdns": { "pdnsid": "12" }, "pdns": { "pdnsid": "12" }, "support_link": "http://radwebhosting.com", "disable_login_logo": 1, "title": "Launch Instance", "resources": { "num_vs": 99999, "num_users": 15, "space": 20, "ram": 1024, "burst": 1024, "bandwidth": 1000, "num_ipv4": 5, "num_ipv6_subnet": 1, "num_ipv6": "1", "cores": "8", "num_cores": "9996", "network_speed": "128000", "upload_speed": "128000", "allowed_virts": { "kvm": "kvm" }, "cloud_allow_virtio": 1 }, "usage": { "num_cores": "4" }, "users": { "372": { "uid": "372", "email": "test@test.com" } }, "ostemplates": { "955": { "osid": "955", "type": "kvm", "name": "centos-7.8-x86_64", "filename": "centos-7.8-x86_64.img", "size": "1560281088", "pygrub": "0", "drive": "", "hvm": "0", "perf_ops": "1", "active": "1", "url": "http://files.virtualizor.com/ostemplates.php?osid=955", "distro": "centos", "Nvirt": "kvm" }, "943": { "osid": "943", "type": "kvm", "name": "centos-8.2-x86_64", "filename": "centos-8.2-x86_64.img", "size": "2000683008", "pygrub": "0", "drive": "", "hvm": "0", "perf_ops": "1", "active": "1", "url": "http://files.virtualizor.com/ostemplates.php?osid=943", "distro": "centos", "Nvirt": "kvm", "mg": [16] }, "878": { "osid": "878", "type": "kvm", "name": "debian-10-x86_64", "filename": "debian-10-x86_64.img", "size": "2738880512", "pygrub": "0", "drive": "", "hvm": "0", "perf_ops": "1", "active": "1", "url": "http://files.virtualizor.com/ostemplates.php?osid=878", "distro": "debian", "Nvirt": "kvm" }, "979": { "osid": "979", "type": "kvm", "name": "debian-11-x86_64", "filename": "debian-11-x86_64.img", "size": "2202009600", "pygrub": "0", "drive": "", "hvm": "0", "perf_ops": "1", "active": "1", "url": "http://files.virtualizor.com/ostemplates.php?osid=979", "distro": "debian", "Nvirt": "kvm" }, "812": { "osid": "812", "type": "kvm", "name": "ubuntu-18.04-x86_64", "filename": "ubuntu-18.04-x86_64.img", "size": "1732247552", "pygrub": "0", "drive": "", "hvm": "0", "perf_ops": "1", "active": "1", "url": "http://files.virtualizor.com/ostemplates.php?osid=812", "distro": "ubuntu", "Nvirt": "kvm" }, }, "isos": { " debian-9.4.0-amd64-netinst.iso": { "iso": "debian-9.4.0-amd64-netinst.iso", "mg": [17], "name": "debian-9.4.0-amd64-netinst.iso", "filename": "debian-9.4.0-amd64-netinst.iso", "size": 305135616, "distro": "debian" }, "Windows_2022_SERVER_EVAL_x64.iso": { "iso": "Windows_2022_SERVER_EVAL_x64.iso", "mg": "", "name": "Windows_2022_SERVER_EVAL_x64.iso", "filename": "Windows_2022_SERVER_EVAL_x64.iso", "size": 5043650560, "distro": "windows" }, }, "servergroups": [{ "sgid": 0, "sg_name": "test", "sg_reseller_name": "USA", "sg_desc": "This is just desc", "sg_select": 0, "virts": { "kvm": "kvm", "openvz": "openvz" } }], "done": { "done": "9999", "msg": "The Virtual Server has been created", "goto": "act=listvs" }, "done_msg": "The Virtual Server has been created", "newvs": { "type": "kvm", "sgid": 8, "rootpass": "Test123!!", "hostname": "testcloud", "space": 20, "ram": 1024, "burst": 0, "swapram": 1024, "bandwidth": 1000, "uid": 372, "cores": 8, "num_ipv4": 5, "num_ipv6": 1, "num_ipv6_subnet": 1, "vnc": 1, "vncpass": "testvnc", "shadow": 0, "iso": "", "boot": "cda", "band_suspend": 1, "tuntap": 0, "osreinstall_limit": 0, "mg": "", "osid": 955, "virtio": 1, "node_select": 1, "server_group": 8, "num_ips": 5, "num_ips6": 1, "num_ips6_subnet": 1, "addvps": 1, "vpsid": "9999", "ips": ["10.10.100.6"], "ips6": ["2602:fe6b:1020:1015:0000:0000:9407:22a1"], "ipv6_subnet": ["2602:fe6b:1020:10eb::/64"] }, "res_limit": { "num_vs": "100000", "num_users": "100000", "space": "500", "ram": "20480", "bandwidth": "10000", "num_ipv4": "20", "num_ipv6_subnet": "20", "num_ipv6": "20", "num_cores": "10", "cores": "8" }, "virts": { "kvm": "kvm", }, "virt_lang": { "kvm": "KVM", }, "time_taken": "3.119" }
You now know how to create VM via API for VPS Resellers.
This article provides an in-depth analysis of our cPanel Shared Hosting server specs and features powering the 100%-SSD cPanel Hosting… Read More
This article provides a guide for server administrators who want to install Webuzo on VPS server with Virtualizor. What is… Read More
This article provides a guide for how to install Bagisto on Rad Web Hosting cPanel account. Our goal today, is… Read More
Running your own Mastodon server on a VPS is an excellent way to enjoy an efficient and secure Mastodon experience.… Read More
This article provides a guide for 6 ways to customize the VPS panel with your branding for Cloud Admin users… Read More
The benefits of SEO are obvious, so let’s look at 4 simplest SEO steps for WordPress that you can take… Read More
View Comments