Create Server
curl --request POST \
--url https://{console}/api/public/v1/servers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"name": "<string>",
"server_type": "<string>",
"ssh_key": "<string>",
"delete_disk_with_server": true,
"disk_gb": 1000,
"user_data": "<string>"
}
'import requests
url = "https://{console}/api/public/v1/servers"
payload = {
"image": "<string>",
"name": "<string>",
"server_type": "<string>",
"ssh_key": "<string>",
"delete_disk_with_server": True,
"disk_gb": 1000,
"user_data": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
name: '<string>',
server_type: '<string>',
ssh_key: '<string>',
delete_disk_with_server: true,
disk_gb: 1000,
user_data: '<string>'
})
};
fetch('https://{console}/api/public/v1/servers', 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://{console}/api/public/v1/servers",
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([
'image' => '<string>',
'name' => '<string>',
'server_type' => '<string>',
'ssh_key' => '<string>',
'delete_disk_with_server' => true,
'disk_gb' => 1000,
'user_data' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{console}/api/public/v1/servers"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{console}/api/public/v1/servers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{console}/api/public/v1/servers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"status": "<string>",
"addresses": [],
"created_at": "2023-11-07T05:31:56Z",
"error_reason": "<string>",
"image_id": "<string>",
"server_type": "<string>",
"site": {
"id": "<string>",
"name": "<string>"
},
"ssh_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"volume_ids": []
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Servers
Create Server
Launch a server. Send an Idempotency-Key header so retries are safe
POST
/
servers
Create Server
curl --request POST \
--url https://{console}/api/public/v1/servers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "<string>",
"name": "<string>",
"server_type": "<string>",
"ssh_key": "<string>",
"delete_disk_with_server": true,
"disk_gb": 1000,
"user_data": "<string>"
}
'import requests
url = "https://{console}/api/public/v1/servers"
payload = {
"image": "<string>",
"name": "<string>",
"server_type": "<string>",
"ssh_key": "<string>",
"delete_disk_with_server": True,
"disk_gb": 1000,
"user_data": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
name: '<string>',
server_type: '<string>',
ssh_key: '<string>',
delete_disk_with_server: true,
disk_gb: 1000,
user_data: '<string>'
})
};
fetch('https://{console}/api/public/v1/servers', 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://{console}/api/public/v1/servers",
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([
'image' => '<string>',
'name' => '<string>',
'server_type' => '<string>',
'ssh_key' => '<string>',
'delete_disk_with_server' => true,
'disk_gb' => 1000,
'user_data' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{console}/api/public/v1/servers"
payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{console}/api/public/v1/servers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{console}/api/public/v1/servers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"name\": \"<string>\",\n \"server_type\": \"<string>\",\n \"ssh_key\": \"<string>\",\n \"delete_disk_with_server\": true,\n \"disk_gb\": 1000,\n \"user_data\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"status": "<string>",
"addresses": [],
"created_at": "2023-11-07T05:31:56Z",
"error_reason": "<string>",
"image_id": "<string>",
"server_type": "<string>",
"site": {
"id": "<string>",
"name": "<string>"
},
"ssh_key": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"volume_ids": []
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
Body
application/json
Response
Successful Response