Add virtual machine SSH keys
Add one or more SSH public keys to a specified virtual machine.
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
virtualMachineIdintegerRequiredExample:
Virtual Machine ID
1268054Body
keysstring[]RequiredExample:
SSH public keys in OpenSSH format to add
["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.com"]Responses
200
Success response
application/json
Array of VPS.V1.SshKey.SshKeyResource
keystringOptionalExample:
SSH public key in OpenSSH format
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g... user@example.comtypestringOptionalExample:
SSH key type
ssh-rsadatastringOptionalExample:
SSH key data (base64 encoded public key)
AAAAB3NzaC1yc2EAAAADAQABAAABAQC0g...namestringOptionalExample:
SSH key comment/name
user@example.com401
Unauthenticated response
application/json
422
Validation error response
application/json
500
Error response
application/json
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?