Attach public key
Attach existing public keys from your account to a specified virtual machine.
Attach existing public keys from your account to a specified virtual machine.
Multiple keys can be attached to a single 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
idsinteger[]RequiredExample:
Public Key IDs to attach
[18232,10230230]Responses
200
Success response
application/json
idintegerOptionalExample:
Action ID
8123712namestringOptionalExample:
Action name
action_namestatestring · enumOptionalExample:
Action state
successPossible values: created_atstring · date-timeOptionalExample:
2025-02-27T11:54:00Zupdated_atstring · date-timeOptionalExample:
2025-02-27T11:58:00Z401
Unauthenticated response
application/json
422
Validation error response
application/json
500
Error response
application/json
post/api/vps/v1/public-keys/attach/{virtualMachineId}
POST /api/vps/v1/public-keys/attach/{virtualMachineId} HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 24
{
"ids": [
18232,
10230230
]
}{
"id": 8123712,
"name": "action_name",
"state": "success",
"created_at": "2025-02-27T11:54:00Z",
"updated_at": "2025-02-27T11:58:00Z"
}Last updated
Was this helpful?