Delete SSH key

This function function deletes an SSH key from the server.

Warning:

Only the root account can use this function, and it only affects the root keys. To perform this function on a cPanel user account, call the cPanel API 2 SSH::authkey function through the WHM API.

SecurityBasicAuth
Request
query Parameters
file
required
string

The SSH key file's name.

Example: file=/root/.ssh/test
leave_authorized
integer
Default: 1

Whether to authorize the SSH key to access the server.

  • 1 — Leave authorized.
  • 0 — Do not leave authorized.
Enum: 0 1
Example: leave_authorized=0
user
string
Deprecated

The SSH key's username.

Example: user=username
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/deletesshkey
Request samples
whmapi1 --output=jsonpretty \
  deletesshkey \
  file='/root/.ssh/test'
Response samples
application/json
{
  • "data": {
    • "file": "/root/.ssh/test"
    },
  • "metadata": {
    • "command": "deletesshkey",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}