Skip to main content
SSH key methods manage the public keys authorized for SSH access to your CVMs. You can add keys manually, import them from a GitHub profile, or sync them from your linked GitHub account.

ListSSHKeys

GET /user/ssh-keys Returns all SSH keys registered for the current user.
Returns: []SSHKey where each SSHKey contains:

CreateSSHKey

POST /user/ssh-keys Registers a new SSH public key.
CreateSSHKeyRequest fields: Returns: *SSHKey — the created key with its assigned ID and fingerprint. Replace the sample public key with your own key before using it for access.

DeleteSSHKey

DELETE /user/ssh-keys/{keyId} Removes an SSH key by its ID. Existing CVMs that were deployed with this key will retain access until they are restarted or updated.
Parameters: Returns: error (no response body on success)

ImportGithubProfileSSHKeys

POST /user/ssh-keys/github-profile Imports SSH public keys from any GitHub user’s profile. This fetches the keys from https://github.com/{username}.keys and adds them to your account.
Parameters: Returns: *ImportGithubResponse (generic map with import details)
This imports keys from any public GitHub profile. Use SyncGithubSSHKeys instead if you want to sync keys from your own linked GitHub account.

SyncGithubSSHKeys

POST /user/ssh-keys/github-sync Syncs SSH keys from the user’s linked GitHub account. This requires that the user has connected their GitHub account to Phala Cloud.
Returns: *SyncGithubResponse (generic map with sync details)

CVM SSH keys

GetCVMSSHKeys(ctx, cvmID) reads GET /cvms/{cvmId}/ssh-keys. It returns the configured Keys and RestartRequired. This is the stored configuration; GetCVMUserConfig reads the running VM’s configuration. UpdateCVMSSHKeys(ctx, cvmID, req) sends PUT /cvms/{cvmId}/ssh-keys and returns the same response type. SSHKeyIDs is the replacement set: include every selected key you want to retain. An explicit empty slice removes all selected keys unless Usernames adds members’ resolved keys. Changes take effect at the next power-on, or immediately if ApplyNow restarts the CVM. This example uses the key created above. Add any other key IDs you want to retain.