For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add virtual machine SSH keys

Add one or more SSH public keys to a specified virtual machine.

Add virtual machine SSH keys

post

Add one or more SSH public keys to a specified virtual machine.

Keys are added to the root user and can be used for passwordless SSH authentication. Returns the complete list of SSH keys currently configured on the virtual machine.

Use this endpoint to enable SSH key authentication for VPS instances.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
virtualMachineIdintegerRequired

Virtual Machine ID

Example: 1268054
Body
keysstring[]Required

SSH public keys in OpenSSH format to add

Example: ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.com"]
Responses
200

Success response

application/json
keystringOptional

SSH public key in OpenSSH format

Example: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.com
typestringOptional

SSH key type

Example: ssh-rsa
datastringOptional

SSH key data (base64 encoded public key)

Example: AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g...
namestringOptional

SSH key comment/name

Example: user@example.com
post/api/vps/v1/virtual-machines/{virtualMachineId}/ssh-keys
POST /api/vps/v1/virtual-machines/{virtualMachineId}/ssh-keys HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 74

{
  "keys": [
    "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.com"
  ]
}
[
  {
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.com",
    "type": "ssh-rsa",
    "data": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g...",
    "name": "user@example.com"
  }
]

Last updated

Was this helpful?