Computes
Create Compute Instance
Provisions a new compute instance under the team associated with the given API key.
POST
/
computes
Create a compute instance
curl --request POST \
--url https://api.strettch.cloud/api/v1/computes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"hostName": "my-server-01",
"image": "UBUNTU-24.04",
"publicKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host"
],
"region": "KGL-1",
"specification": "S-1C-1G",
"tags": [
"production",
"web"
],
"withPublicIp": true
}
'import requests
url = "https://api.strettch.cloud/api/v1/computes"
payload = {
"hostName": "my-server-01",
"image": "UBUNTU-24.04",
"publicKeys": ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host"],
"region": "KGL-1",
"specification": "S-1C-1G",
"tags": ["production", "web"],
"withPublicIp": True
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
hostName: 'my-server-01',
image: 'UBUNTU-24.04',
publicKeys: ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host'],
region: 'KGL-1',
specification: 'S-1C-1G',
tags: ['production', 'web'],
withPublicIp: true
})
};
fetch('https://api.strettch.cloud/api/v1/computes', 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.strettch.cloud/api/v1/computes",
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([
'hostName' => 'my-server-01',
'image' => 'UBUNTU-24.04',
'publicKeys' => [
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host'
],
'region' => 'KGL-1',
'specification' => 'S-1C-1G',
'tags' => [
'production',
'web'
],
'withPublicIp' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://api.strettch.cloud/api/v1/computes"
payload := strings.NewReader("{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://api.strettch.cloud/api/v1/computes")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": true,
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"id": "325",
"hostName": "my-server-01",
"state": "RUNNING",
"image": "UBUNTU-24.04",
"specification": "S-1C-1G",
"region": "KGL-1",
"ipv4": "195.15.0.73",
"privateIpv4": "10.0.0.5",
"tags": [
"production",
"web"
],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}Request Reference
Use these slugs for theregion, image, and specification fields in your request body.
- Regions
- Images
- Specifications
| Slug | Name | Country |
|---|---|---|
KGL-1 | Kigali-1 | 🇷🇼 Rwanda |
| Slug | OS | Version |
|---|---|---|
UBUNTU-24.04 | Ubuntu | 24.04 LTS |
UBUNTU-22.04 | Ubuntu | 22.04 LTS |
The
S prefix stands for Shared CPU. RAM in GB (512 MB for the smallest tier).| Slug | vCPUs | RAM | Storage (SSD) |
|---|---|---|---|
S-1C | 1 | 512 MB | 10 GB |
S-1C-1G | 1 | 1 GB | 20 GB |
S-1C-2G | 1 | 2 GB | 40 GB |
S-2C-4G | 2 | 4 GB | 80 GB |
S-4C-8G | 4 | 8 GB | 160 GB |
S-8C-16G | 8 | 16 GB | 320 GB |
S-16C-32G | 16 | 32 GB | 640 GB |
Response Error Codes
If the request fails, thecode field in the error response will contain one of the following.
- Standard
- Billing & Team
| Code | Status | Description |
|---|---|---|
BAD_REQUEST | 400 | The request was invalid or malformed. |
UNAUTHORIZED | 401 | Authentication failed or was not provided. |
FORBIDDEN | 403 | You do not have permission to perform this action. |
RESOURCE_NOT_FOUND | 404 | The requested resource (image, region, or specification) was not found. |
CONFLICT | 409 | A conflict with the current server state occurred. |
UNPROCESSABLE_ENTITY | 422 | The request was well-formed but failed semantic validation. |
TOO_MANY_REQUESTS | 429 | You have exceeded the rate limit. |
INTERNAL_SERVER_ERROR | 500 | An unexpected error occurred on our end. |
These errors block all resource operations. Resolve your team’s billing status before retrying.
| Code | Status | Description |
|---|---|---|
INSUFFICIENT_BALANCE | 403 | Team balance is too low to provision this instance. |
TEAM_SUSPENDED | 403 | Team is suspended due to an outstanding payment. |
TEAM_PAST_DUE | 403 | Team has an outstanding balance that must be settled first. |
TEAM_TERMINATED | 403 | Team has been terminated and can no longer access resources. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Idempotency key (UUID v4)
Body
application/json
Example:
"my-server-01"
Example:
"UBUNTU-24.04"
Minimum array length:
1Example:
[
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host"
]
Example:
"KGL-1"
e.g. S-1C-1G or S-1C
Example:
"S-1C-1G"
Example:
["production", "web"]
Example:
true
Was this page helpful?
⌘I
Create a compute instance
curl --request POST \
--url https://api.strettch.cloud/api/v1/computes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"hostName": "my-server-01",
"image": "UBUNTU-24.04",
"publicKeys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host"
],
"region": "KGL-1",
"specification": "S-1C-1G",
"tags": [
"production",
"web"
],
"withPublicIp": true
}
'import requests
url = "https://api.strettch.cloud/api/v1/computes"
payload = {
"hostName": "my-server-01",
"image": "UBUNTU-24.04",
"publicKeys": ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host"],
"region": "KGL-1",
"specification": "S-1C-1G",
"tags": ["production", "web"],
"withPublicIp": True
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
hostName: 'my-server-01',
image: 'UBUNTU-24.04',
publicKeys: ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host'],
region: 'KGL-1',
specification: 'S-1C-1G',
tags: ['production', 'web'],
withPublicIp: true
})
};
fetch('https://api.strettch.cloud/api/v1/computes', 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.strettch.cloud/api/v1/computes",
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([
'hostName' => 'my-server-01',
'image' => 'UBUNTU-24.04',
'publicKeys' => [
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host'
],
'region' => 'KGL-1',
'specification' => 'S-1C-1G',
'tags' => [
'production',
'web'
],
'withPublicIp' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://api.strettch.cloud/api/v1/computes"
payload := strings.NewReader("{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://api.strettch.cloud/api/v1/computes")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hostName\": \"my-server-01\",\n \"image\": \"UBUNTU-24.04\",\n \"publicKeys\": [\n \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Z5mS1x7I6n... user@host\"\n ],\n \"region\": \"KGL-1\",\n \"specification\": \"S-1C-1G\",\n \"tags\": [\n \"production\",\n \"web\"\n ],\n \"withPublicIp\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": true,
"timestamp": "2024-01-15T10:00:00Z",
"data": {
"id": "325",
"hostName": "my-server-01",
"state": "RUNNING",
"image": "UBUNTU-24.04",
"specification": "S-1C-1G",
"region": "KGL-1",
"ipv4": "195.15.0.73",
"privateIpv4": "10.0.0.5",
"tags": [
"production",
"web"
],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}