API
SSH keys API
List, save and remove the public SSH keys of your flockvm account over the API, then create VMs with a saved key's id.
The public SSH keys saved in your account, as in Settings → Account → SSH keys. They belong to the user of the API key, not to the organization: every role can list, add and remove their own, and nobody else's. A saved key's id is what ssh_key_id takes when you create a VM. Reading them needs the API key action ssh_key.read, saving and removing them ssh_key.write (see API keys and scopes).
The SSH key object
fingerprint is the SHA256 fingerprint, as ssh-keygen -lf prints it. last_used_at is when a VM was last created with the key, null if never.
List your keys
GET /ssh-keys · Action: ssh_key.read
Newest first.
Save a key
POST /ssh-keys · Action: ssh_key.write
public_keystringrequiredOne OpenSSH public key on one line, the content of your .pub file: ssh-ed25519, ssh-rsa or ecdsa-sha2-nistp256/384/521. See Accepted key formats.
namestringdefault: the key's comment, or its typeUp to 60 characters.
You can save up to 20 keys. You can also save a key while you create a VM, with ssh_public_key and "save_key": true.
Remove a key
DELETE /ssh-keys/{id} · Action: ssh_key.write
The key leaves your account. VMs that already have it keep it in their authorized_keys: see Remove a key to take it out of a VM.
Errors
| Status | code |
Example message |
When |
|---|---|---|---|
| 400 | bad_request |
"Use an ssh-ed25519, ssh-rsa or ecdsa key (the line from your .pub file)." (field: public_key) |
Not a public key, or a format flockvm does not take. The other messages are in SSH keys. |
| 400 | bad_request |
"public_key is required: an OpenSSH public key (ssh-ed25519 AAAA… comment)." (field: public_key) |
No public_key. |
| 400 | bad_request |
"20 SSH keys at most: remove one first." | Your account has 20 keys. |
| 404 | not_found |
"This SSH key is not in your account." | No such key, or another user's. |
| 409 | conflict |
"This key is already in your account, as "laptop"." (field: public_key) |
The same key is saved already. |
Saving and removing SSH keys is not in the organization's audit log, in the API as in the dashboard: keys belong to your account, not to the organization.
Next steps
Pass a saved key's id as ssh_key_id.
Generate a key and add more to a running VM.