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.update_virtual_machine(virtual_machine_id="vm_7vYAZqGBdMQ94", data={
"type": latitudesh_python_sdk.VirtualMachineUpdatePayloadType.VIRTUAL_MACHINES,
"id": "vm_7vYAZqGBdMQ94",
"attributes": {
"name": "my-updated-vm",
},
})
# 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.UpdateVirtualMachine(ctx, "vm_7vYAZqGBdMQ94", components.VirtualMachineUpdatePayload{
Data: components.VirtualMachineUpdatePayloadData{
Type: components.VirtualMachineUpdatePayloadTypeVirtualMachines,
ID: latitudeshgosdk.Pointer("vm_7vYAZqGBdMQ94"),
Attributes: components.VirtualMachineUpdatePayloadAttributes{
Name: latitudeshgosdk.Pointer("my-updated-vm"),
},
},
})
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.updateVirtualMachine({
virtualMachineId: "vm_7vYAZqGBdMQ94",
virtualMachineUpdatePayload: {
data: {
type: "virtual_machines",
id: "vm_7vYAZqGBdMQ94",
attributes: {
name: "my-updated-vm",
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/virtual_machines/{virtual_machine_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machines",
"id": "vm_7vYAZqGBdMQ94",
"attributes": {
"name": "my-updated-vm"
}
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'virtual_machines',
id: 'vm_7vYAZqGBdMQ94',
attributes: {name: 'my-updated-vm'}
}
})
};
fetch('https://api.latitude.sh/virtual_machines/{virtual_machine_id}', 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/{virtual_machine_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'virtual_machines',
'id' => 'vm_7vYAZqGBdMQ94',
'attributes' => [
'name' => 'my-updated-vm'
]
]
]),
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.patch("https://api.latitude.sh/virtual_machines/{virtual_machine_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"id\": \"vm_7vYAZqGBdMQ94\",\n \"attributes\": {\n \"name\": \"my-updated-vm\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machines/{virtual_machine_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"id\": \"vm_7vYAZqGBdMQ94\",\n \"attributes\": {\n \"name\": \"my-updated-vm\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "vm_7vYAZqGBdMQ94",
"type": "virtual_machines",
"attributes": {
"name": "my-updated-vm",
"status": "Running",
"created_at": "2026-01-14T15:57:15+00:00",
"primary_ipv4": "10.0.0.25",
"operating_system": null,
"site": "london-2193",
"billing": "hourly",
"plan": {
"id": "plan_VE1Wd3VQOXnZJ",
"name": "c3.small.x86-143"
},
"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_GpZboxNev1U2pxpmKwWAc8e01vpp",
"name": "702 Team",
"slug": "702-team",
"description": "702 Team",
"address": "Suite 729 8171 Albina Forges, Eldridgeberg, CA 26345-3293",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_W6Q2D9ZQOKLpr",
"name": "Aerodynamic Wool Watch",
"slug": "aerodynamic-wool-watch",
"description": "Intelligent Paper Shirt",
"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
}
}
}
}
}{
"data": {
"id": "<string>",
"type": "virtual_machines",
"attributes": {
"name": "<string>",
"created_at": "<string>",
"status": "<string>",
"primary_ipv4": "<string>",
"operating_system": {
"name": "<string>",
"slug": "<string>",
"version": "<string>",
"features": {
"raid": true,
"ssh_keys": true,
"user_data": true,
"rescue": true,
"workflow": true
},
"distro": {
"name": "<string>",
"slug": "<string>",
"series": "<string>"
}
},
"credentials": {
"username": "<string>",
"host": "<string>",
"password": "<string>",
"ssh_keys": [
{
"id": "<string>",
"name": "<string>",
"fingerprint": "<string>",
"public_key": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
]
},
"site": "<string>",
"billing": "<string>",
"user_data": "<string>",
"plan": {
"id": "<string>",
"name": "<string>"
},
"specs": {
"vcpu": 123,
"ram": "<string>",
"storage": "<string>",
"nic": "<string>",
"gpu": "<string>"
},
"tags": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"color": "<string>"
}
],
"team": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"address": "<string>",
"currency": {
"id": "<string>",
"code": "<string>",
"name": "<string>",
"currency_id": 123
},
"status": "<string>",
"feature_flags": [
"<string>"
],
"limits": {
"bare_metal": 123,
"bare_metal_gpu": 123,
"virtual_machine": 123,
"virtual_machine_gpu": 123,
"elastic_ip": 123,
"virtual_network": 123,
"database": 123,
"filesystem": 123,
"block_storage": 123
}
},
"project": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"billing_type": "<string>",
"provisioning_type": "<string>",
"billing_method": "<string>",
"bandwidth_alert": true,
"environment": "<string>",
"billing": {
"subscription_id": "<string>",
"type": "<string>",
"method": "<string>"
},
"stats": {
"databases": 123,
"ip_addresses": 123,
"prefixes": 123,
"servers": 123,
"storages": 123,
"virtual_machines": 123,
"vlans": 123
}
},
"pending_restart": true
}
},
"meta": {}
}Virtual machines
Update VM
Updates a Virtual Machine’s display name (hostname).
PATCH
/
virtual_machines
/
{virtual_machine_id}
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.update_virtual_machine(virtual_machine_id="vm_7vYAZqGBdMQ94", data={
"type": latitudesh_python_sdk.VirtualMachineUpdatePayloadType.VIRTUAL_MACHINES,
"id": "vm_7vYAZqGBdMQ94",
"attributes": {
"name": "my-updated-vm",
},
})
# 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.UpdateVirtualMachine(ctx, "vm_7vYAZqGBdMQ94", components.VirtualMachineUpdatePayload{
Data: components.VirtualMachineUpdatePayloadData{
Type: components.VirtualMachineUpdatePayloadTypeVirtualMachines,
ID: latitudeshgosdk.Pointer("vm_7vYAZqGBdMQ94"),
Attributes: components.VirtualMachineUpdatePayloadAttributes{
Name: latitudeshgosdk.Pointer("my-updated-vm"),
},
},
})
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.updateVirtualMachine({
virtualMachineId: "vm_7vYAZqGBdMQ94",
virtualMachineUpdatePayload: {
data: {
type: "virtual_machines",
id: "vm_7vYAZqGBdMQ94",
attributes: {
name: "my-updated-vm",
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/virtual_machines/{virtual_machine_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machines",
"id": "vm_7vYAZqGBdMQ94",
"attributes": {
"name": "my-updated-vm"
}
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'virtual_machines',
id: 'vm_7vYAZqGBdMQ94',
attributes: {name: 'my-updated-vm'}
}
})
};
fetch('https://api.latitude.sh/virtual_machines/{virtual_machine_id}', 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/{virtual_machine_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'virtual_machines',
'id' => 'vm_7vYAZqGBdMQ94',
'attributes' => [
'name' => 'my-updated-vm'
]
]
]),
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.patch("https://api.latitude.sh/virtual_machines/{virtual_machine_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"id\": \"vm_7vYAZqGBdMQ94\",\n \"attributes\": {\n \"name\": \"my-updated-vm\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machines/{virtual_machine_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"virtual_machines\",\n \"id\": \"vm_7vYAZqGBdMQ94\",\n \"attributes\": {\n \"name\": \"my-updated-vm\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "vm_7vYAZqGBdMQ94",
"type": "virtual_machines",
"attributes": {
"name": "my-updated-vm",
"status": "Running",
"created_at": "2026-01-14T15:57:15+00:00",
"primary_ipv4": "10.0.0.25",
"operating_system": null,
"site": "london-2193",
"billing": "hourly",
"plan": {
"id": "plan_VE1Wd3VQOXnZJ",
"name": "c3.small.x86-143"
},
"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_GpZboxNev1U2pxpmKwWAc8e01vpp",
"name": "702 Team",
"slug": "702-team",
"description": "702 Team",
"address": "Suite 729 8171 Albina Forges, Eldridgeberg, CA 26345-3293",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_W6Q2D9ZQOKLpr",
"name": "Aerodynamic Wool Watch",
"slug": "aerodynamic-wool-watch",
"description": "Intelligent Paper Shirt",
"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
}
}
}
}
}{
"data": {
"id": "<string>",
"type": "virtual_machines",
"attributes": {
"name": "<string>",
"created_at": "<string>",
"status": "<string>",
"primary_ipv4": "<string>",
"operating_system": {
"name": "<string>",
"slug": "<string>",
"version": "<string>",
"features": {
"raid": true,
"ssh_keys": true,
"user_data": true,
"rescue": true,
"workflow": true
},
"distro": {
"name": "<string>",
"slug": "<string>",
"series": "<string>"
}
},
"credentials": {
"username": "<string>",
"host": "<string>",
"password": "<string>",
"ssh_keys": [
{
"id": "<string>",
"name": "<string>",
"fingerprint": "<string>",
"public_key": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
]
},
"site": "<string>",
"billing": "<string>",
"user_data": "<string>",
"plan": {
"id": "<string>",
"name": "<string>"
},
"specs": {
"vcpu": 123,
"ram": "<string>",
"storage": "<string>",
"nic": "<string>",
"gpu": "<string>"
},
"tags": [
{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"color": "<string>"
}
],
"team": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"address": "<string>",
"currency": {
"id": "<string>",
"code": "<string>",
"name": "<string>",
"currency_id": 123
},
"status": "<string>",
"feature_flags": [
"<string>"
],
"limits": {
"bare_metal": 123,
"bare_metal_gpu": 123,
"virtual_machine": 123,
"virtual_machine_gpu": 123,
"elastic_ip": 123,
"virtual_network": 123,
"database": 123,
"filesystem": 123,
"block_storage": 123
}
},
"project": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"billing_type": "<string>",
"provisioning_type": "<string>",
"billing_method": "<string>",
"bandwidth_alert": true,
"environment": "<string>",
"billing": {
"subscription_id": "<string>",
"type": "<string>",
"method": "<string>"
},
"stats": {
"databases": 123,
"ip_addresses": 123,
"prefixes": 123,
"servers": 123,
"storages": 123,
"virtual_machines": 123,
"vlans": 123
}
},
"pending_restart": true
}
},
"meta": {}
}Was this page helpful?
⌘I