compute
POST /v1/compute/servers/{serverId}/ssh-keys
Add one of the organisation's saved SSH keys to a machine already built.
Authentication
Send an API key as a bearer token. The key must carry the sites.restart permission; a key without it is refused with 403, not 404.
This endpoint takes no organisation id. Your key already identifies the organisation it belongs to, and the response is scoped to it.
Try it
Replace anything in angle brackets with your own values, and the key placeholder with a key from your dashboard.
curl -X POST https://api.zinndigital.com/v1/compute/servers/{serverId}/ssh-keys \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "key_id": <string> }'Signed in? The API console in your dashboard fills in your real organisation id and your own key, and runs the request against the live API so you can see the actual response. Open this endpoint in the API console
Details
A saved key otherwise reaches a machine only when it is ordered. With the web terminal on, we write the one public line into the login user's authorized_keys as a background job (202, mode: queued; idempotent, a second request adds nothing). With the terminal off we cannot reach the machine, so the answer is 200 with mode: manual and the exact command to paste on it. ⛔ The server and the key are both looked up in the server's own organisation: a key id of another organisation is 404, never copied onto this machine. Removing a key from a built machine is not offered here. Requires sites.restart; audited as compute.server.ssh_key_add_requested, then compute.server.ssh_key_added or compute.server.ssh_key_add_failed.
Parameters
| Name | Type | Required | What it is |
|---|---|---|---|
serverId (path) | Uuid | Yes | The server's id, as listComputeServers reports it. Ours (UUIDv7), minted when the order row was written — never the provider's own identifier for the machine. |
Request body
| Name | Type | Required | What it is |
|---|---|---|---|
key_id | string | Yes | The saved key's id, as listComputeSshKeys reported it. |
Response
| Name | Type | Required | What it is |
|---|---|---|---|
mode | string<queued, manual> | Yes | — |
key_id | string | Yes | — |
public_key | string | Yes | The one public line (not a secret). |
command | string | Yes | For manual, the command to paste on the machine; empty when queued. |
reason | string<, terminal_off, built_before_terminal> | No | Why the answer is manual: the web terminal is off, or the machine was built before it was turned on so our key is not on it. Empty when queued. |
Errors this endpoint can return
401 · 403 · 404 · 422 · 429 · 503