Skip to content

SSH Keys

Total endpoints: 4 Example base URL: https://<ROBOT_IP>/rest Required access for this section: ADMIN

List Ssh Keys

  • Endpoint: /api/v2/ssh/keys/
  • Function: List ssh keys.
  • Method: GET
  • Parameters: none
  • Shell Command:
curl -L "https://<ROBOT_IP>/rest/api/v2/ssh/keys/" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/ssh/keys/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "keys": [
    {
      "fingerprint": "SHA256:example",
      "name": "dev-key",
      "created_at": "2026-01-10T14:56:07",
      "location": "both",
      "on_head": true,
      "on_base": true
    }
  ],
  "status": "success",
  "head_error": "",
  "base_error": ""
}

Add Ssh Key

  • Endpoint: /api/v2/ssh/keys/
  • Function: Add ssh key.
  • Method: POST
  • Parameters:
  • payload (body, SSHKeyCreate)
  • Shell Command:
curl -X POST "https://<ROBOT_IP>/rest/api/v2/ssh/keys/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"public_key": "example"}'
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/ssh/keys/"
headers = {"Authorization": "Bearer <token>"}
json_payload = {'public_key': 'example'}
response = requests.post(url, headers=headers, json=json_payload, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "SSH key added successfully.",
  "status": "success"
}

Remove Ssh Key By Fingerprint

  • Endpoint: /api/v2/ssh/keys/fingerprint/{fingerprint:path}/
  • Function: Remove ssh key by fingerprint.
  • Method: DELETE
  • Parameters:
  • fingerprint (path, str)
  • Shell Command:
curl -X DELETE "https://<ROBOT_IP>/rest/api/v2/ssh/keys/fingerprint/SHA256_example/" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/ssh/keys/fingerprint/SHA256_example/"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "SSH key 'SHA256:example' removed successfully.",
  "status": "success"
}

Remove Ssh Key

  • Endpoint: /api/v2/ssh/keys/{key_id}/
  • Function: Remove ssh key.
  • Method: DELETE
  • Parameters:
  • key_id (path, int)
  • Shell Command:
curl -X DELETE "https://<ROBOT_IP>/rest/api/v2/ssh/keys/1/" \
  -H "Authorization: Bearer <token>"
  • Python Command:
import requests

url = "https://<ROBOT_IP>/rest/api/v2/ssh/keys/1/"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers, timeout=10)

print(response.status_code)
print(response.json())
  • Response Example (200):
{
  "message": "SSH key with ID 1 removed successfully.",
  "status": "success"
}