Get an SSH key
GET/api/v1/ssh-keys/{key_id}
One key of the account.
Parameters
| Name | In | Description |
|---|---|---|
| key_id | path, integerrequired | SSH key id, from List SSH keys |
Example request
curl -X GET "https://platform.serverscamp.com/api/v1/ssh-keys/$KEY_ID" \
-H "Authorization: Bearer $API_TOKEN"import os, requests
token = os.environ["API_TOKEN"]
key_id = 42
r = requests.get(
f"https://platform.serverscamp.com/api/v1/ssh-keys/{key_id}",
headers={"Authorization": f"Bearer {token}"},
)
r.raise_for_status()
print(r.json())const keyId = 42;
const r = await fetch(`https://platform.serverscamp.com/api/v1/ssh-keys/${keyId}`, {
method: 'GET',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
});
console.log(r.status, await r.json());Answer
Status 200 with this body.
| Field | Type | Description |
|---|---|---|
| id | integerrequired | Key ID |
| key_name | stringrequired | Key name |
| key_type | stringrequired | Key type (ed25519, rsa, ecdsa, etc.) |
| public_key | stringrequired | Public key in OpenSSH format |
| fingerprint | stringrequired | Key fingerprint (SHA256) |
| has_private_key | booleanrequired | Whether private key is available for download |
| created_at | string, optional | Creation timestamp |
| comment | string, optional | Trailing comment from OpenSSH public key (e.g. user@host) |
| bits | integer, optional | Key strength in bits |
| source | string | 'generated' if private key is stored, else 'imported' |
| strength | string | 'modern' for ed25519/ecdsa, 'legacy' for rsa |
| state | string | 'in-use' if at least one VM trusts this key, else 'unused' |
| last_attached_at | string, optional | When the most recent VM using this key was created |
| trusted_by | list of SSHKeyTrustedVM | VMs that have this key installed |
| trusted_by[].vm_uuid | stringrequired | |
| trusted_by[].name | stringrequired |
Errors
| Status | When |
|---|---|
401 | No token, or a token that is not valid |
404 | No such key in your account |
422 | The body or a parameter is not what the operation takes |
Every operation can also answer 401 without a valid token. All errors