VPS: Virtual machine
Purchase new virtual machine
Changed onPurchase and setup a new virtual machine.
If virtual machine setup fails for any reason, login to hPanel and complete the setup manually.
If no payment method is provided, your default payment method will be used automatically.
If the response is 202 Accepted, the payment is still being processed and the virtual machine was not set up. Login to hPanel and complete the setup manually.
Use this endpoint to create new VPS instances.
post/api/vps/v1/virtual-machines
Request
- Base URL: https://developers.hostinger.com
- URL: https://developers.hostinger.com/api/vps/v1/virtual-machines
- Auth: HTTP bearer
Request body
Example request
{
"item_id": "hostingercom-vps-kvm2-usd-1m",
"payment_method_id": 1327362,
"setup": {
"template_id": 1130,
"data_center_id": 19,
"post_install_script_id": 6324,
"password": "oMeNRustosIO",
"hostname": "my.server.tld",
"enable_backups": true,
"ns1": "4.3.2.1",
"ns2": "1.2.3.4",
"public_key": {
"name": "my-key",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2X..."
}
},
"coupons": [
[
"Coupon 3"
]
]
}Response
Success response
Example response
{
"order": {
"id": 2957086,
"subscription_id": "Azz353Uhl1xC54pR0",
"status": "completed",
"currency": "USD",
"subtotal": 899,
"total": 1088,
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"country": "NL",
"email": "john@doe.tld"
},
"created_at": "2025-02-27T11:54:22Z",
"updated_at": "2025-03-27T11:54:22Z"
},
"virtual_machine": {
"id": 17923,
"subscription_id": "Azz353Uhl1xC54pR0",
"data_center_id": 521,
"plan": "KVM 4",
"hostname": "srv17923.hstgr.cloud",
"state": "running",
"actions_lock": "unlocked",
"cpus": 4,
"memory": 8192,
"disk": 51200,
"bandwidth": 1073741824,
"ns1": "1.1.1.1",
"ns2": "8.8.8.8",
"ipv4": [
{
"id": 52347,
"address": "213.331.273.15",
"ptr": "something.domain.tld"
}
],
"ipv6": [
{
"id": 52347,
"address": "213.331.273.15",
"ptr": "something.domain.tld"
}
],
"template": {
"id": 6523,
"name": "Ubuntu 20.04 LTS",
"description": "Ubuntu 20.04 LTS",
"documentation": "https://docs.ubuntu.com"
},
"created_at": "2024-09-05T07:25:36.00000Z"
}
}Changes
- info
added the success response with the status
- info