Virtual Machines

Add an SSH key to a server

Changed on

Add a key to root's authorized_keys on a running Linux server, at once and without a restart. ssh_key is the ID of a saved key or a public key (the same rule as saved keys); with save_as, a public key is also saved to your account under that name. A key the server already has changes nothing (changed: 0). The key also goes into the server's settings, so a factory reset keeps it. Every change is emailed to the account owner and written to the audit log. Needs vm.ssh_keys; in the dashboard it also asks for a two-factor code.

post/api/v1/vms/{id}/ssh-keys

Request

  • Base URL
    https://api.rafftechnologies.com
  • URL
    https://api.rafftechnologies.com/api/v1/vms/{id}/ssh-keys
  • Auth
    API key in header X-API-Key

Path parameters

idstring uuid required

VM ID (UUID)

Request body

ssh_keystring required

A saved key's ID, or one public key (the whole line of a .pub file)

save_asstring

Also save a public key to your account under this name (ignored for a key you already saved)

Example request

{
  "ssh_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... you@laptop"
}

Response

The server's keys after the add

successboolean

Example response

{
  "data": {
    "keys": [
      {
        "fingerprint": "SHA256:KH7zm92O0/dbuPCSkvuS9zdDvBneuFaHt+qwZbp8OYU",
        "type": "ssh-ed25519",
        "comment": "you@laptop"
      }
    ]
  }
}

Changes