Create a Virtual Machine
Deploy a new VM instance with a single API call. This endpoint provisions compute, attaches a network, and sets up access credentials in one request.
Base URL: https://cloud.octosinfra.com/backend/api
Required information
Before creating a VM, you'll need these slugs from your account. Use the corresponding list endpoints to retrieve them:
| Parameter | Description | How to find |
|---|---|---|
cloud_provider | Cloud provider slug | GET /cloud-providers |
project | Project slug | GET /projects |
region | Data center region slug | GET /regions |
template | OS template slug | GET /templates |
plan | Compute plan slug | GET /plans |
Create a VM
curl -X POST "https://cloud.octosinfra.com/backend/api/virtual-machines" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-web-server",
"hostname": "my-web-server",
"cloud_provider": "alto",
"server": "cloud-compute",
"project": "default-126",
"region": "frankfurt",
"billing_cycle": "hourly",
"template": "ubuntu-2204-1",
"template_type": "Operating System",
"plan": "dv-series-1-1",
"storage_category": "ssd-storage",
"boot_source": "image",
"is_public": true,
"username": "admin",
"password": "YourSecureP@ss123",
"authMethod": "password",
"os_family": "Linux",
"networks": [],
"security_groups": ["dsg-default-126-frankfurt"],
"additional_options": ["monitoring"],
"is_vnf": false,
"is_free_trial_plan": false,
"is_vm_password_required": true,
"is_vm_ssh_required": true
}'
Response:
{
"status": "Success",
"message": "Creating virtual machine",
"data": {
"name": "my-web-server",
"hostname": "my-web-server",
"username": "admin",
"state": "Starting",
"slug": "my-web-server",
"is_vnf": false
}
}
List all VMs
curl -X GET "https://cloud.octosinfra.com/backend/api/virtual-machines?include=cloud_provider,project,region,ipaddresses,virtual_machine_templates,offering" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
Get VM details
curl -X GET "https://cloud.octosinfra.com/backend/api/virtual-machines/{VIRTUAL_MACHINE_SLUG}?include=cloud_provider,region,project,networks,parentable" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
VM power actions
Control your VM's power state:
# Stop a VM
curl -X PUT "https://cloud.octosinfra.com/backend/api/virtual-machines/{VIRTUAL_MACHINE_SLUG}/stop" \
-H "Authorization: Bearer YOUR_API_TOKEN"
# Start a VM
curl -X PUT "https://cloud.octosinfra.com/backend/api/virtual-machines/{VIRTUAL_MACHINE_SLUG}/start" \
-H "Authorization: Bearer YOUR_API_TOKEN"
# Reset (reboot) a VM
curl -X PUT "https://cloud.octosinfra.com/backend/api/virtual-machines/{VIRTUAL_MACHINE_SLUG}/reset" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Endpoint reference
| Action | Method | Endpoint |
|---|---|---|
| List VMs | GET | /virtual-machines |
| Create VM | POST | /virtual-machines |
| Get VM | GET | /virtual-machines/{SLUG} |
| Stop VM | PUT | /virtual-machines/{SLUG}/stop |
| Start VM | PUT | /virtual-machines/{SLUG}/start |
| Reset VM | PUT | /virtual-machines/{SLUG}/reset |
| Change Label | PUT | /virtual-machines/{SLUG}/change-label |
| Change Plan | POST | /virtual-machines/{SLUG}/change-plan |