Use the Delete User Plan API to delete the user plans from the Virtualizor panel, by passing the user's plan ID. The plan ID can be obtained from the list user plans API. For deleting multiple plans you need to pass the IDs as comma separated values. The API response will contain "done" as the information of the deleted user plans if the plan is deleted successfully.
HTTP Request
https://hostname:4085/index.php?act=user_plans
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | user_plans | The act will return "done" as the plan details on success | Yes |
delete | POST | Int | The ID of the plan to be deleted. For multiple IDs pass in the values as comma separated values | No |
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['delete'] = 1;
$post['delete'] = '2,3'; // for deleting multiple plans
$output = $admin->delete_user_plans($post);
print_r(json_encode($output));
?>
Output
{
"title": "Plans",
"done": {
"1": {
"uplid": "1",
"plan_name": "New Plan",
"type": "0",
"aclid": "0",
"inhouse_billing": "0",
"max_cost": "0",
"num_vs": "0",
"num_users": "0",
"space": "0",
"ram": "0",
"burst": "0",
"bandwidth": "0",
"cpu": "0",
"cores": "4",
"cpu_percent": "0",
"num_cores": "0",
"num_ipv4": "0",
"num_ipv6": "0",
"num_ipv6_subnet": "0",
"allowed_virts": "",
"network_speed": "0",
"upload_speed": "-1",
"sg": "",
"mg": "",
"dnsplid": "0",
"service_period": "1",
"band_suspend": "0",
"date_created": "1534518872"
}
},
"plans": null,
"timenow": 1537471226,
"time_taken": "0.127"
}