Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.virtual_machines.create(data={
"type": latitudesh_python_sdk.VirtualMachinePayloadType.VIRTUAL_MACHINES,
"attributes": {
"name": "my-new-vm",
"project": "lightweight-leather-lamp",
},
})
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.VirtualMachines.Create(ctx, components.VirtualMachinePayload{
Data: &components.VirtualMachinePayloadData{
Type: components.VirtualMachinePayloadTypeVirtualMachines.ToPointer(),
Attributes: &components.VirtualMachinePayloadAttributes{
Name: latitudeshgosdk.Pointer("my-new-vm"),
Billing: components.VirtualMachinePayloadBillingMonthly.ToPointer(),
Project: latitudeshgosdk.Pointer("lightweight-leather-lamp"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.VirtualMachine != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.virtualMachines.create({
data: {
type: "virtual_machines",
attributes: {
name: "my-new-vm",
billing: "monthly",
project: "lightweight-leather-lamp",
},
},
});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/virtual_machines \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machines",
"attributes": {
"project": "lightweight-leather-lamp",
"name": "my-new-vm",
"billing": "monthly"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'virtual_machines',
attributes: {project: 'lightweight-leather-lamp', name: 'my-new-vm', billing: 'monthly'}
}
})
};
fetch('https://api.latitude.sh/virtual_machines', 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.latitude.sh/virtual_machines",
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([
'data' => [
'type' => 'virtual_machines',
'attributes' => [
'project' => 'lightweight-leather-lamp',
'name' => 'my-new-vm',
'billing' => 'monthly'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.latitude.sh/virtual_machines")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"attributes\": {\n \"project\": \"lightweight-leather-lamp\",\n \"name\": \"my-new-vm\",\n \"billing\": \"monthly\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machines")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"attributes\": {\n \"project\": \"lightweight-leather-lamp\",\n \"name\": \"my-new-vm\",\n \"billing\": \"monthly\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "vm_mw49QDB5qagKb",
"type": "virtual_machines",
"attributes": {
"name": "my-new-vm",
"status": "Starting",
"created_at": "2026-01-14T15:57:13+00:00",
"primary_ipv4": "192.168.1.50",
"operating_system": {
"name": "Ubuntu 24.04 LTS",
"slug": "ubuntu_24_04_x64_lts",
"version": "24.04 x64 LTS",
"features": {
"raid": true,
"ssh_keys": true,
"user_data": true
},
"distro": {
"name": "Ubuntu",
"slug": "ubuntu",
"series": "noble"
}
},
"site": "FRA181",
"billing": "monthly",
"plan": {
"id": "plan_VE1Wd3VXOXnZJ",
"name": "g3.h100.large-131"
},
"specs": {
"vcpu": 16,
"ram": "128 GB",
"storage": "100 GB",
"nic": "1 x 1 Gbps",
"gpu": "1 x NVIDIA H100 Tensor Core GPU"
},
"team": {
"id": "team_zAbb72Zm3VS3N0o89Y48sGXv3mZ",
"name": "690 Team",
"slug": "690-team",
"description": "690 Team",
"address": "Apt. 922 405 Ondricka Lights, Lake Jennineview, SC 58925-4625",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_GMy1Dbk1ON50m",
"name": "Lightweight Leather Lamp",
"slug": "lightweight-leather-lamp",
"description": "Sleek Wool Plate",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": null,
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 0,
"storages": 0,
"virtual_machines": 1,
"vlans": 0
}
}
}
}
}Virtual machines
Create VM
Creates a new Virtual Machine.
POST
/
virtual_machines
Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.virtual_machines.create(data={
"type": latitudesh_python_sdk.VirtualMachinePayloadType.VIRTUAL_MACHINES,
"attributes": {
"name": "my-new-vm",
"project": "lightweight-leather-lamp",
},
})
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.VirtualMachines.Create(ctx, components.VirtualMachinePayload{
Data: &components.VirtualMachinePayloadData{
Type: components.VirtualMachinePayloadTypeVirtualMachines.ToPointer(),
Attributes: &components.VirtualMachinePayloadAttributes{
Name: latitudeshgosdk.Pointer("my-new-vm"),
Billing: components.VirtualMachinePayloadBillingMonthly.ToPointer(),
Project: latitudeshgosdk.Pointer("lightweight-leather-lamp"),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.VirtualMachine != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.virtualMachines.create({
data: {
type: "virtual_machines",
attributes: {
name: "my-new-vm",
billing: "monthly",
project: "lightweight-leather-lamp",
},
},
});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/virtual_machines \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machines",
"attributes": {
"project": "lightweight-leather-lamp",
"name": "my-new-vm",
"billing": "monthly"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'virtual_machines',
attributes: {project: 'lightweight-leather-lamp', name: 'my-new-vm', billing: 'monthly'}
}
})
};
fetch('https://api.latitude.sh/virtual_machines', 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.latitude.sh/virtual_machines",
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([
'data' => [
'type' => 'virtual_machines',
'attributes' => [
'project' => 'lightweight-leather-lamp',
'name' => 'my-new-vm',
'billing' => 'monthly'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.latitude.sh/virtual_machines")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"attributes\": {\n \"project\": \"lightweight-leather-lamp\",\n \"name\": \"my-new-vm\",\n \"billing\": \"monthly\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machines")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"attributes\": {\n \"project\": \"lightweight-leather-lamp\",\n \"name\": \"my-new-vm\",\n \"billing\": \"monthly\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "vm_mw49QDB5qagKb",
"type": "virtual_machines",
"attributes": {
"name": "my-new-vm",
"status": "Starting",
"created_at": "2026-01-14T15:57:13+00:00",
"primary_ipv4": "192.168.1.50",
"operating_system": {
"name": "Ubuntu 24.04 LTS",
"slug": "ubuntu_24_04_x64_lts",
"version": "24.04 x64 LTS",
"features": {
"raid": true,
"ssh_keys": true,
"user_data": true
},
"distro": {
"name": "Ubuntu",
"slug": "ubuntu",
"series": "noble"
}
},
"site": "FRA181",
"billing": "monthly",
"plan": {
"id": "plan_VE1Wd3VXOXnZJ",
"name": "g3.h100.large-131"
},
"specs": {
"vcpu": 16,
"ram": "128 GB",
"storage": "100 GB",
"nic": "1 x 1 Gbps",
"gpu": "1 x NVIDIA H100 Tensor Core GPU"
},
"team": {
"id": "team_zAbb72Zm3VS3N0o89Y48sGXv3mZ",
"name": "690 Team",
"slug": "690-team",
"description": "690 Team",
"address": "Apt. 922 405 Ondricka Lights, Lake Jennineview, SC 58925-4625",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_GMy1Dbk1ON50m",
"name": "Lightweight Leather Lamp",
"slug": "lightweight-leather-lamp",
"description": "Sleek Wool Plate",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": null,
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 0,
"storages": 0,
"virtual_machines": 1,
"vlans": 0
}
}
}
}
}Was this page helpful?
⌘I