Use the Delete User API to delete the user from the Virtualizor panel, by passing the user's ID. The IDs can be obtained by the list users API. For deleting multiple users you need to the pass the IDs as comma separated values. The API response will contain "done" as the array of the user's information after the user has been successfully deleted.
HTTP Request
https://hostname:4085/index.php?act=users
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | users | The action will list the users after a specific operation is executed | Yes |
delete | POST | Int | The ID of the users to be deleted. For deleting multiple users, pass in the IDs as comma separated values | Yes |
dont_delete_vms | POST | Int | If this parameter is passed then it will not delete the VM(s) of that user. If you are deleting cloud user and this param is not passed, then cloud user and his subusers and their respective VM(s) will be deleted as well. (Since 3.0.1+) | 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'] = 57;
$post['delete_vms'] = 1; // For deleting VMs (optional)
$post['delete'] = '58,59'; // for deleting multiple users
$output = $admin->delete_users($post);
print_r(json_encode($output));
?>
Output
{
"title": "Users",
"done": {
"58": {
"uid": "58",
"email": "test@test.com",
"dnsplid": "0"
},
"59": {
"uid": "59",
"email": "test_email@gmail.com",
"dnsplid": "0"
}
},
"users": null,
"timenow": 1535987367,
"time_taken": "0.229"
}