Return SSH keys list

This function lists the server's SSH keys.

Warning:

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

SecurityBasicAuth
Request
query Parameters
files
string

A filename, to limit the results to keys that have that filename.

Example: files=TestKey
private
integer
Default: 1

Whether to display only private keys.

  • 1 — Display only private keys.
  • 0 — Display all keys.
Enum: 0 1
Example: private=0
private_texts
integer
Default: 1

Whether to include private key text.

  • 1 — Include private key text.
  • 0 — Do not include private key text.
Enum: 0 1
Example: private_texts=0
public
integer

Whether to display only public keys.

  • 1 — Display only public keys.
  • 0 — Display all keys.
Enum: 0 1
Example: public=0
public_texts
integer
Default: 0

Whether to include public key text.

  • 1 — Include public key text.
  • 0 — Do not include public key text.
Enum: 0 1
Example: public_texts=0
sync_authorized
integer
Default: 0

Whether to synchronize the keys that can access the server.

  • 1 — Synchronize the keys.
  • 0 — Do not synchronize the keys.
Enum: 0 1
Example: sync_authorized=0
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/listsshkeys
Request samples
whmapi1 --output=jsonpretty \
  listsshkeys
Response samples
application/json
{
  • "data": {
    • "keys": [
      • {
        • "authorized": 0,
        • "comment": "REPO username@example.com",
        • "ctime": 1416596824,
        • "file": "TestKey",
        • "mtime": 1416596824,
        • "private": 1,
        • "text": "ssh-rsaXXXXX3XXXX1XX2XXXXXXXXXXXXXXxXXXX6XXXXX90X41X7XXXXX02XXXXX8XXXX54XXXXXXXXXXX2X07XXXXXXXXXXX7XXXX4XXX2X98XXXX98X80XXXXXXX7X/X4XXXXxX1XXXXXXXXXXXxXXXXXXXXX6+4XXXX36XXXXX3XXXXXX1XXXXXXX/X7+XX1XX6XXXX0XXXXXXX0XXXXXXXX+XxX99X7X2XXXXXX03xXXXXX0XXXXXXXXXX9XXXXXXX9XXXXXXXXXXXX/XXXXX07XXXXX3XXXXXX5XXX+/XXXXXXXXXXXXX3XxXXXXXXXXXXXX6XXXXXXXXXXXX2XXXXXXXXXXXXXXXXX3XX+XXXX3XXXXXXX== REPO username@example.com"
        }
      ]
    },
  • "metadata": {
    • "command": "listsshkeys",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}