Skip to main content
POST
/
api
/
v2
/
external
/
vms
/
create
Create Vm
curl --request POST \
  --url https://api.example.com/api/v2/external/vms/create \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_public_key": "<string>",
  "hardware_profile": "<string>",
  "instance_specs": {},
  "display_name": "<string>",
  "instance_type": "on-demand"
}
'
import requests

url = "https://api.example.com/api/v2/external/vms/create"

payload = {
"user_public_key": "<string>",
"hardware_profile": "<string>",
"instance_specs": {},
"display_name": "<string>",
"instance_type": "on-demand"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
user_public_key: '<string>',
hardware_profile: '<string>',
instance_specs: {},
display_name: '<string>',
instance_type: 'on-demand'
})
};

fetch('https://api.example.com/api/v2/external/vms/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v2/external/vms/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'user_public_key' => '<string>',
'hardware_profile' => '<string>',
'instance_specs' => [

],
'display_name' => '<string>',
'instance_type' => 'on-demand'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/api/v2/external/vms/create"

payload := strings.NewReader("{\n \"user_public_key\": \"<string>\",\n \"hardware_profile\": \"<string>\",\n \"instance_specs\": {},\n \"display_name\": \"<string>\",\n \"instance_type\": \"on-demand\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/api/v2/external/vms/create")
.header("Content-Type", "application/json")
.body("{\n \"user_public_key\": \"<string>\",\n \"hardware_profile\": \"<string>\",\n \"instance_specs\": {},\n \"display_name\": \"<string>\",\n \"instance_type\": \"on-demand\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/v2/external/vms/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_public_key\": \"<string>\",\n \"hardware_profile\": \"<string>\",\n \"instance_specs\": {},\n \"display_name\": \"<string>\",\n \"instance_type\": \"on-demand\"\n}"

response = http.request(request)
puts response.read_body
{
  "vm_id": "<string>",
  "status": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "instance_specs": {},
  "ip_address": "<string>",
  "hardware_profile": "<string>",
  "gpu_count": 123,
  "instance_type": "<string>",
  "name": "<string>",
  "display_name": "<string>",
  "billed": 123,
  "croesus_billed": 123,
  "status_check_url": "<string>",
  "polling_message": "<string>",
  "user_id": "<string>",
  "org_id": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Body

application/json

Request model for creating a new VM.

user_public_key
string
required
Minimum string length: 1
hardware_profile
string
required
instance_specs
Instance Specs · object | null
display_name
string | null
instance_type
enum<string>
default:on-demand
Available options:
on-demand,
spot

Response

Successful Response

Response model for VM operations.

vm_id
string
required
status
string
required
created_at
string<date-time>
required
instance_specs
Instance Specs · object
required
ip_address
string | null
hardware_profile
string | null
gpu_count
integer | null
instance_type
string | null
name
string | null
display_name
string | null
billed
number | null
croesus_billed
number | null
status_check_url
string | null
polling_message
string | null
user_id
string | null
org_id
string | null