Skip to content

Save an SSH key

POST /api/v2/ssh-keys

Saves an SSH public key on your Hostup account. You can then pick it when you order a VPS or add keys to a VPS with PATCH /api/v2/vps/{id}/ssh-access. Saving a key does not add it to any VPS that already exists.

Accepted key types are ssh-ed25519, ssh-rsa, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-dss and the hardware-key types sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com. Any other key returns 400 invalid_public_key. A key that is already saved on the account returns 409 duplicate_fingerprint.

Web hosting accounts keep their own keys. Add those with POST /api/v2/shared-hosting/{accountId}/ssh-keys.

Authentication: An API key with the scope write:account. About keys and scopes

Request

Body

namestringrequired
A name for the key, up to 100 characters.
publicKeystringrequired
The full public key line: key type, key data and an optional comment. Up to 4000 characters.

Example

POST /api/v2/ssh-keys
curl -X POST "https://cloud.hostup.se/api/v2/ssh-keys" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "deploy-key",
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9wZW5BUElFeGFtcGxlS2V5TWF0ZXJpYWwxMjM0 ops@example.com"
}'

Responses

201 The saved key.

Response 201
{
"id": "ssh_01hxa3b4c5d6e7f8g9h0j1k2m3",
"name": "deploy-key",
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9wZW5BUElFeGFtcGxlS2V5TWF0ZXJpYWwxMjM0 ops@example.com",
"fingerprint": "SHA256:8pQ3ExampleFingerprintForDocsOnly",
"keyType": "ed25519",
"createdAt": "2026-04-27T12:34:56.000Z",
"actions": {
"canRename": {
"allowed": true,
"reason": null
},
"canDelete": {
"allowed": true,
"reason": null
}
}
}
Response fields
idstring
displayIdstring
An older display label on the SSH key list of a VPS. Use name and fingerprint instead.
namestring
publicKeystring
fingerprintstring or null
keyTypestring
One of rsa, ed25519, ecdsa, dsa, unknown.
createdAtstring or null
lastUsedAtstring or null
When the key was last used. Present only on the SSH key list of a VPS, when known.
actionsobject
Present on the account’s SSH key list.
canRenameobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.
canDeleteobject
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400code is invalid_public_key when the key cannot be read. It is invalid_request when name or publicKey is missing or too long.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller.
409code is duplicate_fingerprint. The same key is already saved on the account.
429Too many requests. Wait the number of seconds in Retry-After before you try again.
500Internal error. Retry later or contact support if the issue persists.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.