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.elastic_ips.update_elastic_ip(elastic_ip_id="eip_KeQbB4BoO6x10", data={
"type": latitudesh_python_sdk.UpdateElasticIPType.ELASTIC_IPS,
"attributes": {
"server_id": "sv_oDEBlwBGRO2me",
},
})
# 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.ElasticIps.UpdateElasticIP(ctx, "eip_KeQbB4BoO6x10", components.UpdateElasticIP{
Data: components.UpdateElasticIPData{
Type: components.UpdateElasticIPTypeElasticIps,
Attributes: components.UpdateElasticIPAttributes{
ServerID: "sv_oDEBlwBGRO2me",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.ElasticIP != 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.elasticIps.updateElasticIp({
elasticIpId: "eip_KeQbB4BoO6x10",
updateElasticIp: {
data: {
type: "elastic_ips",
attributes: {
serverId: "sv_oDEBlwBGRO2me",
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/elastic_ips/{elastic_ip_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "elastic_ips",
"attributes": {
"server_id": "sv_oDEBlwBGRO2me"
}
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: {type: 'elastic_ips', attributes: {server_id: 'sv_oDEBlwBGRO2me'}}})
};
fetch('https://api.latitude.sh/elastic_ips/{elastic_ip_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/elastic_ips/{elastic_ip_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' => 'elastic_ips',
'attributes' => [
'server_id' => 'sv_oDEBlwBGRO2me'
]
]
]),
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/elastic_ips/{elastic_ip_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"elastic_ips\",\n \"attributes\": {\n \"server_id\": \"sv_oDEBlwBGRO2me\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/elastic_ips/{elastic_ip_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\": \"elastic_ips\",\n \"attributes\": {\n \"server_id\": \"sv_oDEBlwBGRO2me\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "eip_KeQbB4BoO6x10",
"type": "elastic_ips",
"attributes": {
"address": "177.54.156.7",
"family": "IPv4",
"prefix_length": 32,
"mode": "routed",
"status": "moving",
"created_at": "2026-02-24T17:06:28.108Z",
"server": {
"id": "sv_oDEBlwBGRO2me",
"hostname": "new-server",
"primary_ipv4": "177.54.157.180",
"operating_system": "ubuntu_24_04_x64_lts"
},
"project": {
"id": "proj_AoW6vRnwkvLn0",
"name": "My Project",
"slug": "my-project"
},
"region": {
"id": "region_sa_sao_paulo",
"name": "São Paulo",
"location": {
"id": "site_sao",
"name": "São Paulo",
"slug": "SAO"
}
}
}
}
}Elastic Ips
Move an Elastic IP
Moves an Elastic IP to a different server within the same project and site. The reassignment is performed asynchronously. The Elastic IP must be in active status, the target server must belong to the same project, and the target server must be in the same site as the currently assigned server.
PATCH
/
elastic_ips
/
{elastic_ip_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.elastic_ips.update_elastic_ip(elastic_ip_id="eip_KeQbB4BoO6x10", data={
"type": latitudesh_python_sdk.UpdateElasticIPType.ELASTIC_IPS,
"attributes": {
"server_id": "sv_oDEBlwBGRO2me",
},
})
# 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.ElasticIps.UpdateElasticIP(ctx, "eip_KeQbB4BoO6x10", components.UpdateElasticIP{
Data: components.UpdateElasticIPData{
Type: components.UpdateElasticIPTypeElasticIps,
Attributes: components.UpdateElasticIPAttributes{
ServerID: "sv_oDEBlwBGRO2me",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.ElasticIP != 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.elasticIps.updateElasticIp({
elasticIpId: "eip_KeQbB4BoO6x10",
updateElasticIp: {
data: {
type: "elastic_ips",
attributes: {
serverId: "sv_oDEBlwBGRO2me",
},
},
},
});
console.log(result);
}
run();curl --request PATCH \
--url https://api.latitude.sh/elastic_ips/{elastic_ip_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "elastic_ips",
"attributes": {
"server_id": "sv_oDEBlwBGRO2me"
}
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: {type: 'elastic_ips', attributes: {server_id: 'sv_oDEBlwBGRO2me'}}})
};
fetch('https://api.latitude.sh/elastic_ips/{elastic_ip_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/elastic_ips/{elastic_ip_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' => 'elastic_ips',
'attributes' => [
'server_id' => 'sv_oDEBlwBGRO2me'
]
]
]),
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/elastic_ips/{elastic_ip_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"elastic_ips\",\n \"attributes\": {\n \"server_id\": \"sv_oDEBlwBGRO2me\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/elastic_ips/{elastic_ip_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\": \"elastic_ips\",\n \"attributes\": {\n \"server_id\": \"sv_oDEBlwBGRO2me\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "eip_KeQbB4BoO6x10",
"type": "elastic_ips",
"attributes": {
"address": "177.54.156.7",
"family": "IPv4",
"prefix_length": 32,
"mode": "routed",
"status": "moving",
"created_at": "2026-02-24T17:06:28.108Z",
"server": {
"id": "sv_oDEBlwBGRO2me",
"hostname": "new-server",
"primary_ipv4": "177.54.157.180",
"operating_system": "ubuntu_24_04_x64_lts"
},
"project": {
"id": "proj_AoW6vRnwkvLn0",
"name": "My Project",
"slug": "my-project"
},
"region": {
"id": "region_sa_sao_paulo",
"name": "São Paulo",
"location": {
"id": "site_sao",
"name": "São Paulo",
"slug": "SAO"
}
}
}
}
}Was this page helpful?
⌘I