Get Virtualizor

Clone VPS

Virtualizor Clone VPS API allows you to seamlessly clone VPS from one server to another server OR same server without any manual intervention. The cloning process transfers all your VPS data including configuration and user data. During cloning, an exact copy of the VPS will be made on different storage disk of the server.

The API response will contain "actid" which can be used to monitor the migration process at admin panel or using the Task API.

It is recommended that you save the VPS data before starting this process as Virtualizor will power off the VPS to do the transfer.

For more information, you can refer this Clone VPS Guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETcloneThe action specified to carry out operation and return data after vps has been clonedYes
vpsidPOSTarrayArray of the vps IDs to be clonedYes
from_serverPOSTfrom_serverThe server ID from which the vps needs to be clonedYes
storagePOSTarrayArray of storage ID to be passed for cloning multidisk vpsYes
to_serverPOSTIntThe server ID to which the vps will be clonedYes
speed_limitPOSTIntSetting a speed limit for vps cloningNo
ignore_if_vdfconflictPOST1/0If checked will ignore domain forwarding conflictsNo
disable_gzipPOST1/0If checked, compression (i.e. gzip) will not be used during migrationNo
preserve_ipPOST1/0Set this option to use same IP Address(s) on the migrated VPSNo

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['from_server'] = '0';
    $post['vpsid'] = array('180');
    $post['storage'] = array('1', '5');    
    $post['to_server'] = '0';
    $post['speed_limit'] = '40';

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

    print_r(json_encode($output));
?>

Output

{
  "title": "Virtualizor",
  "actid": "403",
  "timenow": 1535367552,
  "time_taken": "4.162"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list