SSH Keys
SSH keys let you sign in to your servers as the depfloy user. A key is either yours (account-level, managed under System → SSH keys) or belongs to one server. On this page, we will dive into the endpoints you can use to manage both.
The SSH key model #
A key placed on a server goes into the depfloy user’s authorized_keys, and that user has root on the server. Adding a key is therefore the same tier as opening a terminal: the two POST endpoints need terminal:write (Owner, Admin and Developer). An API token limited to specific abilities needs the terminal:write ability for them. The DELETE endpoints need server:update (Owner, Admin, Manager and Developer). See SSH Keys for the same rules in the panel.
The public key you send is stored but never returned: public_key is not part of any response.
Properties #
- id integer
-
Unique identifier for the key.
- key_name string
-
The name you gave the key.
- user_id integer
-
Set on an account-level key: the user it belongs to.
nullon a server key. - server_id integer
-
Set on a server key: the server it belongs to.
nullon an account-level key. - fingerprint string
-
The key’s MD5 fingerprint.
- status integer
-
0 = Installing, 1 = Installed, 2 = Error, 3 = Deleting, 4 = Deleted.
- created_at timestamp
-
When the key was added.
/api/v1/ssh-keysList your SSH keys #
Returns your own account-level keys; no permission beyond a valid token is needed. Keys that belong to a single server are listed with GET /api/v1/servers/:id/ssh-keys, below.
curl https://app.depfloy.com/api/v1/ssh-keys \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"{
"status": "success",
"data": [
{
"id": 5120,
"key_name": "laptop",
"user_id": 84,
"server_id": null,
"fingerprint": "3f:9a:1c:42:7d:e0:5b:88:21:c4:90:6e:af:13:57:d2",
"status": 1,
"created_at": "2026-10-23T09:12:44.000000Z"
}
]
}/api/v1/ssh-keysAdd an SSH key #
Adds an account-level key. With add_to_all_servers, Depfloy also queues its installation on all servers and the key starts in status 0 (Installing). Needs terminal:write.
Required attributes #
- key_name string
-
A name for the key, up to 255 characters.
- public_key string
-
The public key, for example the contents of
~/.ssh/id_ed25519.pub.
Optional attributes #
- add_to_all_servers boolean
-
Install the key on all servers. Defaults to
false.
curl https://app.depfloy.com/api/v1/ssh-keys \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"key_name": "laptop",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... you@laptop",
"add_to_all_servers": false
}'{
"status": "success",
"message": "SSH key created.",
"data": {
"id": 5120,
"key_name": "laptop",
"user_id": 84,
"fingerprint": "3f:9a:1c:42:7d:e0:5b:88:21:c4:90:6e:af:13:57:d2",
"status": 1,
"created_at": "2026-10-23T09:12:44.000000Z"
}
}/api/v1/ssh-keys/:idDelete an SSH key #
Deletes an account-level key. Needs server:update.
Optional attributes #
- scope string
-
depfloy(default) removes the key from Depfloy; copies already installed on servers stay there.all-serversalso removes it from all servers; the key reads status 3 (Deleting) while that runs.
curl -X DELETE https://app.depfloy.com/api/v1/ssh-keys/5120 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ "scope": "all-servers" }'{
"status": "success",
"message": "SSH key deletion processed."
}/api/v1/servers/:id/ssh-keysList a server’s SSH keys #
Returns the keys that belong to one server. Needs server:read.
curl https://app.depfloy.com/api/v1/servers/183009/ssh-keys \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"{
"status": "success",
"data": [
{
"id": 5121,
"key_name": "ci-runner",
"user_id": null,
"server_id": 183009,
"fingerprint": "a1:07:5e:c9:32:4b:f8:6d:90:2e:17:bb:c0:48:6a:13",
"status": 1,
"created_at": "2026-10-23T09:20:05.000000Z"
}
]
}/api/v1/servers/:id/ssh-keysAdd an SSH key to a server #
Adds a key to one server and queues its installation. The key starts in status 0 (Installing). Needs terminal:write.
Required attributes #
- key_name string
-
A name for the key, up to 255 characters.
- public_key string
-
The public key.
curl https://app.depfloy.com/api/v1/servers/183009/ssh-keys \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"key_name": "ci-runner",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... ci@runner"
}'{
"status": "success",
"message": "SSH key queued for installation.",
"data": {
"id": 5121,
"key_name": "ci-runner",
"server_id": 183009,
"fingerprint": "a1:07:5e:c9:32:4b:f8:6d:90:2e:17:bb:c0:48:6a:13",
"status": 0,
"created_at": "2026-10-23T09:20:05.000000Z"
}
}/api/v1/servers/:id/ssh-keys/:keyRemove an SSH key from a server #
Deletes a server’s key from Depfloy and starts its removal from the server. Needs server:update.
curl -X DELETE https://app.depfloy.com/api/v1/servers/183009/ssh-keys/5121 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"{
"status": "success",
"message": "SSH key removal started."
}Errors #
403— your role or the token’s abilities do not include the permission the endpoint needs.404— the key or the server does not exist, or is outside your access.422— validation failed, for example a missingkey_nameor apublic_keythat is not a valid public key.
See Errors for the response format.