Skip to content

Replace the saved SSH keys on a VPS

POST /api/v2/vps/{id}/actions/reset-ssh-keys

Replace the saved SSH keys on a VPS with the keys you list. This endpoint is deprecated. Use GET /api/v2/vps/{id}/ssh-access and PATCH on the same path to list and change each access entry.

Only the lines that came from the previous saved selection are changed in the server’s authorized keys file. Every other key and its options stay as they are. When the file cannot be read, for example because the VPS is stopped, the call returns 409 and nothing changes. Start the VPS and try again. When the file changes while the call runs, it also returns 409 and nothing is overwritten. The call is refused with 403 when the VPS has reached its bandwidth limit.

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

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Body

sshKeyIdsarray of stringrequired
Saved SSH key IDs (ssh_…) from GET /api/v2/vps/{id}/ssh-keys. Send [] to remove the saved keys only.

Example

POST /api/v2/vps/{id}/actions/reset-ssh-keys
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/reset-ssh-keys" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sshKeyIds": [
"ssh_01hxa3b4c5d6e7f8g9h0j1k2m3"
]
}'

Responses

200 The saved keys are replaced on the running server.

Response 200
{
"accepted": true,
"keyCount": 1,
"effect": "immediate",
"managementScope": "saved_key_selection",
"unmanagedKeysPreserved": true
}
Response fields
acceptedboolean
keyCountinteger
At least 0.
effectstring
immediate: the keys were written to the running VPS and checked. next_boot: they take effect at the next boot. One of immediate, next_boot.
managementScopestring
What this call changes: only the keys saved for the VPS. Other keys on the server are not part of it. One of saved_key_selection.
unmanagedKeysPreservedboolean
True when the running VPS was checked and the keys added straight to authorized_keys, with or without options, are still there. False when the change waits for the next boot and this is not checked yet.

Errors

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

400Invalid request. The response body is an RFC 7807 Problem Details document.
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; code is vps_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.