Documentation Index
Fetch the complete documentation index at: https://docs.phala.com/llms.txt
Use this file to discover all available pages before exploring further.
SSH key methods manage the public keys associated with your Phala Cloud account. These keys are injected into CVMs at boot time, giving you SSH access to your running instances.
list_ssh_keys
GET /user/ssh-keys
Lists all SSH keys registered to your account.
Parameters: None.
Returns: List of SSH key objects.
Example:
keys = client.list_ssh_keys()
for key in keys:
print(key.id, key.name, key.fingerprint)
create_ssh_key
POST /user/ssh-keys
Adds a new SSH public key to your account.
Parameters:
| Field | Type | Required | Description |
|---|
name | str | Yes | Display name for the key |
public_key | str | Yes | SSH public key content (e.g., ssh-ed25519 AAAA...) |
Returns: The created SSH key object.
Example:
key = client.create_ssh_key({
"name": "my-laptop",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@laptop",
})
print(key.id)
delete_ssh_key
DELETE /user/ssh-keys/{keyId}
Removes an SSH key from your account. Existing CVMs that were provisioned with this key will retain it until they are restarted.
Parameters:
| Field | Type | Required | Description |
|---|
key_id | str | Yes | SSH key identifier |
Returns: None
Example:
client.delete_ssh_key({"key_id": "key-abc123"})
import_github_profile_ssh_keys
POST /user/ssh-keys/github-profile
Imports SSH public keys from a GitHub user profile. This fetches the keys listed at https://github.com/{username}.keys and adds them to your account.
Parameters:
| Field | Type | Required | Description |
|---|
github_username | str | Yes | GitHub username to import keys from |
Returns: Import response with the number of keys imported.
Example:
result = client.import_github_profile_ssh_keys({
"github_username": "octocat",
})
print(result.model_dump())
sync_github_ssh_keys
POST /user/ssh-keys/github-sync
Syncs SSH keys from your connected GitHub account. This requires that your Phala Cloud account is linked to GitHub via OAuth. Unlike import_github_profile_ssh_keys, this uses your authenticated GitHub connection and keeps keys in sync.
Parameters: None.
Returns: Sync response with details of added/removed keys.
Example:
result = client.sync_github_ssh_keys()
print(result.model_dump())