Use Delete SSH key API to delete existing SSH key on VPS of your server.
HTTP Request
https://hostname:4083/index.php?act=sshkeys
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | sshkeys | The action which will return data belonging to a particular page. | Yes |
delete | POST | text | Provide SSH key ids separated by comma. | Yes |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'host_ip';
$v = new Virtualizor_Enduser_API($ip, $key, $pass);
$keyids['delete'] = '4';//single id
//or
$keyids['delete'] = '4,5,6';//multiple ids
$vps = $v->sshkeys($keyids);
print_r(json_encode($vps));
?>
Curl
curl -k -X POST -d "delete=4" -L "https://hostname:4083/index.php?act=sshkeys&api=json&apikey=your_api_key&apipass=your_api_pass"
Output
{
"uid":"600",
"act":"sshkeys",
"timezone":2,
"timenow":"July 25, 2019, 7:21 am",
"vpsid":"6710",
"username":"a@a.com",
"user_type":"2",
"preferences":{
"theme":"default",
"language":"english",
"timezone":2
},
"url":"index.php?",
"rdns":{
"pdnsid":null
},
"support_link":"http:\/\/softaculous.com",
"enable_eu_iso":1,
"billing_symbol":"$",
"enable_registration":0,
"inhouse_billing":"0",
"title":"KVMTestServer",
"done":{
"msg":"The SSH Key has been deleted successfully."
},
"ssh_keys":[
],
"time_taken":"0.088"
}