Go (SDK)
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.Lks.CreateLksCluster(ctx, components.CreateLksCluster{
Data: components.CreateLksClusterData{
Type: components.CreateLksClusterTypeLksClusters,
Attributes: components.CreateLksClusterAttributes{
Name: "production",
ProjectID: "proj_6059EqYkOQj8p",
Site: "DAL2",
KubernetesVersion: "1.36.3",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.LksCluster != nil {
// handle response
}
}curl --request POST \
--url https://api.latitude.sh/lks/clusters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "lks_clusters",
"attributes": {
"name": "production",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"kubernetes_version": "1.36.3"
}
}
}
'import requests
url = "https://api.latitude.sh/lks/clusters"
payload = { "data": {
"type": "lks_clusters",
"attributes": {
"name": "production",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"kubernetes_version": "1.36.3"
}
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'lks_clusters',
attributes: {
name: 'production',
project_id: 'proj_6059EqYkOQj8p',
site: 'DAL2',
kubernetes_version: '1.36.3'
}
}
})
};
fetch('https://api.latitude.sh/lks/clusters', 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/lks/clusters",
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' => 'lks_clusters',
'attributes' => [
'name' => 'production',
'project_id' => 'proj_6059EqYkOQj8p',
'site' => 'DAL2',
'kubernetes_version' => '1.36.3'
]
]
]),
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/lks/clusters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"lks_clusters\",\n \"attributes\": {\n \"name\": \"production\",\n \"project_id\": \"proj_6059EqYkOQj8p\",\n \"site\": \"DAL2\",\n \"kubernetes_version\": \"1.36.3\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/clusters")
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\": \"lks_clusters\",\n \"attributes\": {\n \"name\": \"production\",\n \"project_id\": \"proj_6059EqYkOQj8p\",\n \"site\": \"DAL2\",\n \"kubernetes_version\": \"1.36.3\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "lksc_pRMLydp0dQKr1",
"type": "lks_clusters",
"attributes": {
"name": "production",
"description": "",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"status": "provisioning",
"message": "",
"reason": "CreatingNetwork",
"control_plane_endpoint": null,
"kubeconfig_url": null,
"kubernetes_version": "1.36.3",
"platform_version": "lks-v1.36.3-002",
"network": {
"pod_cidrs": [
"10.0.0.0/12"
],
"service_cidrs": [
"10.96.0.0/15"
],
"node_cidrs": [
"10.16.0.0/21"
]
},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
}
}
}LKS
Create an LKS cluster
Creates an LKS cluster. The cluster is the control plane only — worker capacity is added separately through node pools (POST /lks/clusters/{cluster_id}/nodepools).
site must be one of the slugs returned by GET /lks/sites, and kubernetes_version must be a patch listed by GET /lks/available_versions with available_for_creation: true.
The cluster is returned immediately with status: "provisioning". Poll GET /lks/clusters/{id} until status is ready, then fetch the kubeconfig.
POST
/
lks
/
clusters
Go (SDK)
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.Lks.CreateLksCluster(ctx, components.CreateLksCluster{
Data: components.CreateLksClusterData{
Type: components.CreateLksClusterTypeLksClusters,
Attributes: components.CreateLksClusterAttributes{
Name: "production",
ProjectID: "proj_6059EqYkOQj8p",
Site: "DAL2",
KubernetesVersion: "1.36.3",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.LksCluster != nil {
// handle response
}
}curl --request POST \
--url https://api.latitude.sh/lks/clusters \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "lks_clusters",
"attributes": {
"name": "production",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"kubernetes_version": "1.36.3"
}
}
}
'import requests
url = "https://api.latitude.sh/lks/clusters"
payload = { "data": {
"type": "lks_clusters",
"attributes": {
"name": "production",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"kubernetes_version": "1.36.3"
}
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'lks_clusters',
attributes: {
name: 'production',
project_id: 'proj_6059EqYkOQj8p',
site: 'DAL2',
kubernetes_version: '1.36.3'
}
}
})
};
fetch('https://api.latitude.sh/lks/clusters', 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/lks/clusters",
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' => 'lks_clusters',
'attributes' => [
'name' => 'production',
'project_id' => 'proj_6059EqYkOQj8p',
'site' => 'DAL2',
'kubernetes_version' => '1.36.3'
]
]
]),
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/lks/clusters")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"lks_clusters\",\n \"attributes\": {\n \"name\": \"production\",\n \"project_id\": \"proj_6059EqYkOQj8p\",\n \"site\": \"DAL2\",\n \"kubernetes_version\": \"1.36.3\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/clusters")
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\": \"lks_clusters\",\n \"attributes\": {\n \"name\": \"production\",\n \"project_id\": \"proj_6059EqYkOQj8p\",\n \"site\": \"DAL2\",\n \"kubernetes_version\": \"1.36.3\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "lksc_pRMLydp0dQKr1",
"type": "lks_clusters",
"attributes": {
"name": "production",
"description": "",
"project_id": "proj_6059EqYkOQj8p",
"site": "DAL2",
"status": "provisioning",
"message": "",
"reason": "CreatingNetwork",
"control_plane_endpoint": null,
"kubeconfig_url": null,
"kubernetes_version": "1.36.3",
"platform_version": "lks-v1.36.3-002",
"network": {
"pod_cidrs": [
"10.0.0.0/12"
],
"service_cidrs": [
"10.96.0.0/15"
],
"node_cidrs": [
"10.16.0.0/21"
]
},
"created_at": "2026-09-01T12:00:00Z",
"updated_at": "2026-09-01T12:00:00Z"
}
}
}Was this page helpful?