Create a new virtual machine
Create one or more virtual machines with the specified configuration.
Single VM: Returns a single job object for tracking.
Multiple VMs: Returns an array of job objects - one for each VM created. Each VM is provisioned in parallel after datacenter initialization.
Batch Creation: Use numberOfInstances to create multiple VMs (e.g., "web-server-1", "web-server-2", etc.).
Each VM gets its own resource job for independent progress tracking.
- Type: stringFormat: uuiddatacenter
Id requiredID of the datacenter where VMs will be created. The backend automatically selects the appropriate cloud provider based on datacenter.
- Type: stringFormat: uuidimage
Id requiredUUID of the OS image to use
- Type: stringnamerequired
Base name for the VM(s). If numberOfInstances > 1, VMs will be named "name-1", "name-2", etc.
- Type: stringFormat: uuidsku
Id requiredUUID of the VM SKU (from
GET /resource/data-centers/{id}/virtual-machine-sizes). Phase 3 Stage 6 cutover replaced the legacyconfigurationId(integer FK) with this UUID-typed identifier. Hard cut — clients sendingconfigurationIdwill receive a 400. - Type: booleanallocate
Public Ip Whether to allocate a public IP address on the primary network. Only supported on standard networks, not custom L2 networks.
- Type: stringenumauth
Method Authentication method for the VM. Required when the image's
config.customizationsincludessshKeyorpassword; omit for images with no auth customizations (e.g. appliances with fixed credentials).ssh-key: SSH key only —sshKeyIdrequired, password auth disabled entirely.password: Password auth —passwordrequired, never stored server-side.
values- ssh
-key - password
- custom
- Type: array object[] 1…5network
Interfaces Optional array of network interface configurations (max 5 network interfaces). Exactly one interface must be marked as primary. If not provided, the default network for the datacenter will be created/used automatically. All networks must be in the same datacenter as the VM. If allocatePublicIp is true, the primary network must be a standard (L3) network.
Example:
[ { "networkId": "550e8400-e29b-41d4-a716-446655440000", "primary": true }, { "networkId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "primary": false } ] - Type: numbernumber
Of Instances min:1max:10Number of VMs to create (default 1, max 10)
- Type: stringpasswordmin length:12max length:20
Pattern: ^[A-Za-z0-9!@#%\-_.]+$VM admin password. Required when
authMethodispassword. Must be 12–20 characters and contain at least one uppercase letter, one lowercase letter, one digit, and one special character. Allowed special characters:! @ # % - _ .The password is passed to the provisioning system and never stored server-side. - Type: stringFormat: uuidresource
Group Id Optional resource group ID to assign VMs to
- Type: stringFormat: uuidssh
Key Id SSH key library UUID to use for authentication. Required when
authMethodisssh-key. UseGET /resource/ssh-keysto list available keys. - Type: stringusernamemin length:3max length:20
Linux only. Username for the VM's admin user. Only supported when
config.customizations.usernameis true. Overrides the image default (e.g.ubuntu,centos,debian). If omitted, the image's default username is used. Reserved system usernames (e.g.root,guest) are rejected with a400. SeeGET /resource/data-centers/{id}/virtual-machine-images→meta.constraints.usernamesfor the full list.
- application/json
- application/json
- application/json
- application/json
- application/json
- application/json
curl https://api.gpcn.com/v1/resource/virtual-machines \
--request POST \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_SECRET_TOKEN' \
--data '{
"datacenterId": "",
"imageId": "",
"skuId": "",
"name": "",
"resourceGroupId": "",
"numberOfInstances": 1,
"allocatePublicIp": false,
"networkInterfaces": [
{
"networkId": "",
"primary": true
}
],
"authMethod": "ssh-key",
"sshKeyId": "",
"password": "",
"username": "myuser"
}'
{
"success": true,
"message": "string",
"data": {
"jobs": [
{
"jobId": "123e4567-e89b-12d3-a456-426614174000",
"resourceType": "virtual_machine",
"resourceDisplayName": "string",
"operation": "create",
"stage": "initializing",
"progressPercentage": 0,
"message": "string",
"errorMessage": "string",
"estimatedCompletion": "2026-05-19T14:02:02.487Z",
"timeRemaining": "string",
"canRetry": true,
"isCompleted": true,
"hasFailed": true,
"resourceId": "123e4567-e89b-12d3-a456-426614174000",
"resourceName": "string",
"createdAt": "2026-05-19T14:02:02.487Z",
"updatedAt": "2026-05-19T14:02:02.487Z"
}
]
},
"meta": null
}.png)