SSH Keys API
Upload and manage SSH public keys. Keys are injected into Droplets at creation time via cloud-init.
List SSH Keys
Response:
[
{
"id": "sk_a1b2c3d4",
"project_id": "proj_default",
"name": "my-laptop",
"public_key": "ssh-rsa AAAAB3NzaC1yc2E...",
"fingerprint": "md5:3b:2e:4f:...",
"created_at": "2024-01-15T10:30:00Z"
}
]
Add an SSH Key
Descriptive name for the key
SSH public key (RSA, Ed25519, or ECDSA)
{
"name": "my-laptop",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@laptop"
}
Response: 201 Created
{
"id": "sk_a1b2c3d4",
"name": "my-laptop",
"fingerprint": "md5:3b:2e:4f:a1:b2:c3:d4:e5:f6:g7:h8:i9:j0:k1:l2:m3",
"created_at": "2024-01-15T10:30:00Z"
}
Delete an SSH Key
DELETE /api/v1/ssh-keys/{id}
Deleting a key does not remove it from already-created Droplets. It only prevents the key from being used for future Droplets.
Using SSH Keys with Droplets
Reference key IDs when creating a Droplet:
POST /api/v1/droplets
{
"name": "web-server",
"image": "ubuntu-22-04",
"plan_id": "s-1vcpu-1gb",
"region": "nyc1",
"ssh_key_ids": ["sk_a1b2c3d4", "sk_e5f6g7h8"]
}
The public keys are embedded in the VM’s cloud-init configuration, allowing SSH access:
ssh root@<droplet-public-ip>