curl --request POST \
--url https://compute.{region}.basaltic.sh/v1/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "web-01",
"flavor": "550e8400-e29b-41d4-a716-446655440000",
"networks": [
{
"subnet": "9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60",
"mac": "02:1a:2b:3c:4d:5e",
"security_groups": [
"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
],
"floating_ip_assignment": "none",
"addresses": [
{
"address": "<string>"
}
]
}
],
"description": "Primary web server",
"architecture": "amd64",
"image": "debian-13",
"volumes": [
{
"volume": "crn:storage:sa-saopaulo-1:my-account:volume/data",
"delete_on_termination": false,
"boot": false,
"size_gb": 20,
"performance": {
"iops": 6000,
"throughput_mib_s": 250
},
"mount_path": "/data",
"fstype": "ext4",
"snapshot_schedules": [
{
"name": "<string>",
"interval_minutes": 1440,
"retention_count": 7,
"description": "<string>",
"retention_days": 30,
"enabled": true,
"tags": {
"environment": "production",
"team": "backend"
}
}
]
}
],
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"user_data": "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==",
"iam_role": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
'import requests
url = "https://compute.{region}.basaltic.sh/v1/instances"
payload = {
"name": "web-01",
"flavor": "550e8400-e29b-41d4-a716-446655440000",
"networks": [
{
"subnet": "9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60",
"mac": "02:1a:2b:3c:4d:5e",
"security_groups": ["c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"],
"floating_ip_assignment": "none",
"addresses": [{ "address": "<string>" }]
}
],
"description": "Primary web server",
"architecture": "amd64",
"image": "debian-13",
"volumes": [
{
"volume": "crn:storage:sa-saopaulo-1:my-account:volume/data",
"delete_on_termination": False,
"boot": False,
"size_gb": 20,
"performance": {
"iops": 6000,
"throughput_mib_s": 250
},
"mount_path": "/data",
"fstype": "ext4",
"snapshot_schedules": [
{
"name": "<string>",
"interval_minutes": 1440,
"retention_count": 7,
"description": "<string>",
"retention_days": 30,
"enabled": True,
"tags": {
"environment": "production",
"team": "backend"
}
}
]
}
],
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"user_data": "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==",
"iam_role": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
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({
name: 'web-01',
flavor: '550e8400-e29b-41d4-a716-446655440000',
networks: [
{
subnet: '9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60',
mac: '02:1a:2b:3c:4d:5e',
security_groups: ['c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f'],
floating_ip_assignment: 'none',
addresses: [{address: '<string>'}]
}
],
description: 'Primary web server',
architecture: 'amd64',
image: 'debian-13',
volumes: [
{
volume: 'crn:storage:sa-saopaulo-1:my-account:volume/data',
delete_on_termination: false,
boot: false,
size_gb: 20,
performance: {iops: 6000, throughput_mib_s: 250},
mount_path: '/data',
fstype: 'ext4',
snapshot_schedules: [
{
name: '<string>',
interval_minutes: 1440,
retention_count: 7,
description: '<string>',
retention_days: 30,
enabled: true,
tags: {environment: 'production', team: 'backend'}
}
]
}
],
metadata: {environment: 'production', team: 'backend'},
tags: {environment: 'production', team: 'backend'},
user_data: 'I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==',
iam_role: 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
})
};
fetch('https://compute.{region}.basaltic.sh/v1/instances', 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://compute.{region}.basaltic.sh/v1/instances",
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([
'name' => 'web-01',
'flavor' => '550e8400-e29b-41d4-a716-446655440000',
'networks' => [
[
'subnet' => '9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60',
'mac' => '02:1a:2b:3c:4d:5e',
'security_groups' => [
'c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f'
],
'floating_ip_assignment' => 'none',
'addresses' => [
[
'address' => '<string>'
]
]
]
],
'description' => 'Primary web server',
'architecture' => 'amd64',
'image' => 'debian-13',
'volumes' => [
[
'volume' => 'crn:storage:sa-saopaulo-1:my-account:volume/data',
'delete_on_termination' => false,
'boot' => false,
'size_gb' => 20,
'performance' => [
'iops' => 6000,
'throughput_mib_s' => 250
],
'mount_path' => '/data',
'fstype' => 'ext4',
'snapshot_schedules' => [
[
'name' => '<string>',
'interval_minutes' => 1440,
'retention_count' => 7,
'description' => '<string>',
'retention_days' => 30,
'enabled' => true,
'tags' => [
'environment' => 'production',
'team' => 'backend'
]
]
]
]
],
'metadata' => [
'environment' => 'production',
'team' => 'backend'
],
'tags' => [
'environment' => 'production',
'team' => 'backend'
],
'user_data' => 'I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==',
'iam_role' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
]),
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://compute.{region}.basaltic.sh/v1/instances"
payload := strings.NewReader("{\n \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\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://compute.{region}.basaltic.sh/v1/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.{region}.basaltic.sh/v1/instances")
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 \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\n}"
response = http.request(request)
puts response.read_body{
"instance": {
"faults": [
{
"code": "BACKUP_FAILED",
"severity": "error",
"message": "Backup upload failed.",
"details": {},
"first_at": "2023-11-07T05:31:56Z",
"last_at": "2023-11-07T05:31:56Z",
"occurrences": 1
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:my-account:instance/web-01",
"name": "web-server-01",
"description": "Primary web server",
"task_state": null,
"flavor": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:platform:flavor/standard-2",
"name": "m1.medium",
"description": "Medium instance with 2 vCPUs and 4GB RAM",
"vcpus": 2,
"ram_mb": 4096,
"class": "shared",
"family": "general",
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"image": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:my-account:image/ubuntu-24.04/architecture/amd64/version/20260901",
"name": "ubuntu-24.04",
"architecture": "amd64",
"version": "20260807",
"status": "active",
"faults": [
{
"code": "BACKUP_FAILED",
"severity": "error",
"message": "Backup upload failed.",
"details": {},
"first_at": "2023-11-07T05:31:56Z",
"last_at": "2023-11-07T05:31:56Z",
"occurrences": 1
}
],
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z",
"description": "Ubuntu 24.04 LTS (Noble Numbat)",
"os": "ubuntu",
"os_version": "24.04",
"is_current": true,
"eol_date": "2026-08-31",
"size_bytes": 2361393152,
"min_disk_gb": 10,
"min_ram_mb": 1024,
"withdrawal_reason": "end_of_life",
"deletion_retention": {
"reason": "in_use",
"instances": 1,
"instance_pools": 1
},
"tags": {
"environment": "production",
"team": "backend"
},
"attributes": {}
},
"user_data": "<string>",
"iam_role": {
"id": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"crn": "crn:iam::my-account:role/deploy",
"name": "deploy"
},
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"launched_at": "2026-01-15T09:31:12Z",
"terminated_at": null,
"desired_state": "running",
"current_state": "running"
}
}{
"error": {
"code": "INVALID_INPUT",
"message": "Invalid request parameters",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "ACCESS_DENIED",
"message": "You don't have permission to perform this action",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "CONFLICT",
"message": "Resource with this name already exists",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "IDEMPOTENCY_KEY_REUSED",
"message": "This Idempotency-Key was already used with a different request payload",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}Criar uma instância
Criar uma nova instância de computação
curl --request POST \
--url https://compute.{region}.basaltic.sh/v1/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "web-01",
"flavor": "550e8400-e29b-41d4-a716-446655440000",
"networks": [
{
"subnet": "9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60",
"mac": "02:1a:2b:3c:4d:5e",
"security_groups": [
"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
],
"floating_ip_assignment": "none",
"addresses": [
{
"address": "<string>"
}
]
}
],
"description": "Primary web server",
"architecture": "amd64",
"image": "debian-13",
"volumes": [
{
"volume": "crn:storage:sa-saopaulo-1:my-account:volume/data",
"delete_on_termination": false,
"boot": false,
"size_gb": 20,
"performance": {
"iops": 6000,
"throughput_mib_s": 250
},
"mount_path": "/data",
"fstype": "ext4",
"snapshot_schedules": [
{
"name": "<string>",
"interval_minutes": 1440,
"retention_count": 7,
"description": "<string>",
"retention_days": 30,
"enabled": true,
"tags": {
"environment": "production",
"team": "backend"
}
}
]
}
],
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"user_data": "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==",
"iam_role": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
'import requests
url = "https://compute.{region}.basaltic.sh/v1/instances"
payload = {
"name": "web-01",
"flavor": "550e8400-e29b-41d4-a716-446655440000",
"networks": [
{
"subnet": "9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60",
"mac": "02:1a:2b:3c:4d:5e",
"security_groups": ["c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"],
"floating_ip_assignment": "none",
"addresses": [{ "address": "<string>" }]
}
],
"description": "Primary web server",
"architecture": "amd64",
"image": "debian-13",
"volumes": [
{
"volume": "crn:storage:sa-saopaulo-1:my-account:volume/data",
"delete_on_termination": False,
"boot": False,
"size_gb": 20,
"performance": {
"iops": 6000,
"throughput_mib_s": 250
},
"mount_path": "/data",
"fstype": "ext4",
"snapshot_schedules": [
{
"name": "<string>",
"interval_minutes": 1440,
"retention_count": 7,
"description": "<string>",
"retention_days": 30,
"enabled": True,
"tags": {
"environment": "production",
"team": "backend"
}
}
]
}
],
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"user_data": "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==",
"iam_role": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
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({
name: 'web-01',
flavor: '550e8400-e29b-41d4-a716-446655440000',
networks: [
{
subnet: '9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60',
mac: '02:1a:2b:3c:4d:5e',
security_groups: ['c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f'],
floating_ip_assignment: 'none',
addresses: [{address: '<string>'}]
}
],
description: 'Primary web server',
architecture: 'amd64',
image: 'debian-13',
volumes: [
{
volume: 'crn:storage:sa-saopaulo-1:my-account:volume/data',
delete_on_termination: false,
boot: false,
size_gb: 20,
performance: {iops: 6000, throughput_mib_s: 250},
mount_path: '/data',
fstype: 'ext4',
snapshot_schedules: [
{
name: '<string>',
interval_minutes: 1440,
retention_count: 7,
description: '<string>',
retention_days: 30,
enabled: true,
tags: {environment: 'production', team: 'backend'}
}
]
}
],
metadata: {environment: 'production', team: 'backend'},
tags: {environment: 'production', team: 'backend'},
user_data: 'I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==',
iam_role: 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
})
};
fetch('https://compute.{region}.basaltic.sh/v1/instances', 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://compute.{region}.basaltic.sh/v1/instances",
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([
'name' => 'web-01',
'flavor' => '550e8400-e29b-41d4-a716-446655440000',
'networks' => [
[
'subnet' => '9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60',
'mac' => '02:1a:2b:3c:4d:5e',
'security_groups' => [
'c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f'
],
'floating_ip_assignment' => 'none',
'addresses' => [
[
'address' => '<string>'
]
]
]
],
'description' => 'Primary web server',
'architecture' => 'amd64',
'image' => 'debian-13',
'volumes' => [
[
'volume' => 'crn:storage:sa-saopaulo-1:my-account:volume/data',
'delete_on_termination' => false,
'boot' => false,
'size_gb' => 20,
'performance' => [
'iops' => 6000,
'throughput_mib_s' => 250
],
'mount_path' => '/data',
'fstype' => 'ext4',
'snapshot_schedules' => [
[
'name' => '<string>',
'interval_minutes' => 1440,
'retention_count' => 7,
'description' => '<string>',
'retention_days' => 30,
'enabled' => true,
'tags' => [
'environment' => 'production',
'team' => 'backend'
]
]
]
]
],
'metadata' => [
'environment' => 'production',
'team' => 'backend'
],
'tags' => [
'environment' => 'production',
'team' => 'backend'
],
'user_data' => 'I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==',
'iam_role' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
]),
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://compute.{region}.basaltic.sh/v1/instances"
payload := strings.NewReader("{\n \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\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://compute.{region}.basaltic.sh/v1/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.{region}.basaltic.sh/v1/instances")
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 \"name\": \"web-01\",\n \"flavor\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"networks\": [\n {\n \"subnet\": \"9b2e4f1a-3c5d-4e6f-8a90-1b2c3d4e5f60\",\n \"mac\": \"02:1a:2b:3c:4d:5e\",\n \"security_groups\": [\n \"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f\"\n ],\n \"floating_ip_assignment\": \"none\",\n \"addresses\": [\n {\n \"address\": \"<string>\"\n }\n ]\n }\n ],\n \"description\": \"Primary web server\",\n \"architecture\": \"amd64\",\n \"image\": \"debian-13\",\n \"volumes\": [\n {\n \"volume\": \"crn:storage:sa-saopaulo-1:my-account:volume/data\",\n \"delete_on_termination\": false,\n \"boot\": false,\n \"size_gb\": 20,\n \"performance\": {\n \"iops\": 6000,\n \"throughput_mib_s\": 250\n },\n \"mount_path\": \"/data\",\n \"fstype\": \"ext4\",\n \"snapshot_schedules\": [\n {\n \"name\": \"<string>\",\n \"interval_minutes\": 1440,\n \"retention_count\": 7,\n \"description\": \"<string>\",\n \"retention_days\": 30,\n \"enabled\": true,\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n }\n }\n ]\n }\n ],\n \"metadata\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"tags\": {\n \"environment\": \"production\",\n \"team\": \"backend\"\n },\n \"user_data\": \"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg==\",\n \"iam_role\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\"\n}"
response = http.request(request)
puts response.read_body{
"instance": {
"faults": [
{
"code": "BACKUP_FAILED",
"severity": "error",
"message": "Backup upload failed.",
"details": {},
"first_at": "2023-11-07T05:31:56Z",
"last_at": "2023-11-07T05:31:56Z",
"occurrences": 1
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:my-account:instance/web-01",
"name": "web-server-01",
"description": "Primary web server",
"task_state": null,
"flavor": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:platform:flavor/standard-2",
"name": "m1.medium",
"description": "Medium instance with 2 vCPUs and 4GB RAM",
"vcpus": 2,
"ram_mb": 4096,
"class": "shared",
"family": "general",
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"image": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"crn": "crn:compute:sa-saopaulo-1:my-account:image/ubuntu-24.04/architecture/amd64/version/20260901",
"name": "ubuntu-24.04",
"architecture": "amd64",
"version": "20260807",
"status": "active",
"faults": [
{
"code": "BACKUP_FAILED",
"severity": "error",
"message": "Backup upload failed.",
"details": {},
"first_at": "2023-11-07T05:31:56Z",
"last_at": "2023-11-07T05:31:56Z",
"occurrences": 1
}
],
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z",
"description": "Ubuntu 24.04 LTS (Noble Numbat)",
"os": "ubuntu",
"os_version": "24.04",
"is_current": true,
"eol_date": "2026-08-31",
"size_bytes": 2361393152,
"min_disk_gb": 10,
"min_ram_mb": 1024,
"withdrawal_reason": "end_of_life",
"deletion_retention": {
"reason": "in_use",
"instances": 1,
"instance_pools": 1
},
"tags": {
"environment": "production",
"team": "backend"
},
"attributes": {}
},
"user_data": "<string>",
"iam_role": {
"id": "b2c3d4e5-f6a7-8901-2345-67890abcdef1",
"crn": "crn:iam::my-account:role/deploy",
"name": "deploy"
},
"metadata": {
"environment": "production",
"team": "backend"
},
"tags": {
"environment": "production",
"team": "backend"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"launched_at": "2026-01-15T09:31:12Z",
"terminated_at": null,
"desired_state": "running",
"current_state": "running"
}
}{
"error": {
"code": "INVALID_INPUT",
"message": "Invalid request parameters",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "ACCESS_DENIED",
"message": "You don't have permission to perform this action",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "CONFLICT",
"message": "Resource with this name already exists",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "IDEMPOTENCY_KEY_REUSED",
"message": "This Idempotency-Key was already used with a different request payload",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}compute:CreateInstance. Consulte permissões de computação para obter a lista completa, o que cada uma abrange e um exemplo de política.Autorizações
Um token bearer OAuth 2.0, enviado como Authorization: Bearer <token>. Esta é a forma recomendada de autenticação.
Obtenha o token trocando o par de chaves de acesso de uma conta de serviço em POST /v1/oauth/token com grant_type=client_credentials. Esse é o fluxo padrão de credenciais de cliente; bibliotecas compatíveis com OAuth podem obter e renovar o token para você.
curl -s -u "$KEY_ID:$SECRET" -d grant_type=client_credentials \
https://iam.basaltic.sh/v1/oauth/token
Os tokens duram uma hora por padrão. O mesmo par de chaves de acesso também serve como credencial AWS SigV4 para o endpoint de objetos compatível com S3, que aceita somente esse método de autenticação.
Cabeçalhos
Chave opcional gerada pelo cliente que torna uma criação segura para reprodução. A reintentar uma solicitação com a mesma chave retorna o resultado original literalmente em vez de criar um recurso duplicado. A reutilização de uma chave com um corpo de solicitação diferente é rejeitada (422); uma solicitação cuja chave ainda está sendo processada retorna 409. Os registros são honrados por 24 horas. Use um UUID ou token exclusivo semelhante.
255Corpo
Os nomes de recursos não devem começar com o prefixo literal crn: ou ser UUIDs (formas canônicas, compactas, entre colchetes ou urn:uuid:, em qualquer caso).
1 - 255"web-01"
Referência de tipo de instância regional (UUID, CRN ou nome exato)
"550e8400-e29b-41d4-a716-446655440000"
Interfaces para anexar, pelo menos uma. índice 0 é a NIC primária.
Necessário porque uma instância sem interface inicializa sem rede e nada dentro dela pode adicionar uma depois.
1Show child attributes
Show child attributes
1000"Primary web server"
Arquitetura para nomes de imagem e tags name:version (padrão amd64); um CRN fixa sua própria arquitetura e versão.
Imagem para clonar o disco de inicialização. Obrigatório a menos que volumes contenha um volume de inicialização existente; não pode ser combinado com um volume de inicialização existente. Quatro formas são aceitas: uma imagem completa/nome/arquitetura/arquitetura/versão/versão CRN; um id de imagem; name:version, que fixa uma compilação e é como você opta por sair da tag movendo-se sob você; ou um name nu, que segue a tag para qualquer compilação que seja atual quando a instância é criada. Os nomes preferem uma compilação utilizável de propriedade do chamador sobre uma compilação de catálogo de plataformas marcada para a arquitetura solicitada (padrão amd64). Um CRN identifica o proprietário, o nome, a arquitetura e a versão. A resolução nunca retenta outro tipo de referência; respostas e modelos armazenados retêm o UUID da imagem resolvida.
"debian-13"
Discos novos ou existentes ligados com a instância, o disco de inicialização incluído — marque-o com boot: true. No máximo, uma entrada pode.
Omita a entrada de inicialização para usar o tamanho mínimo da imagem e a camada padrão da região.
Crie um novo disco, opcionalmente com desempenho provisionado, ou anexe um volume disponível existente nesta conta e região usando volume. Os volumes existentes mantêm seu conteúdo, desempenho e agendamentos de snapshot; eles são retidos após falha de inicialização ou exclusão de instância. Requer compute:AttachVolume para discos existentes. Um volume só pode ocorrer uma vez. Um disco de inicialização existente deve ser inicializável e substitui a imagem de nível superior.
- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
{
"environment": "production",
"team": "backend"
}
Show child attributes
Show child attributes
{
"environment": "production",
"team": "backend"
}
Dados de usuário codificados em Base64 (cloud-init)
"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg=="
Anexe uma função do IAM da mesma conta por UUID, CRN ou nome exato. A política de confiança da função deve permitir crn:compute:*:*:instance/* (ou o CRN da instância específica). O endpoint IMDS da instância (169.254.169.254) mantém as credenciais STS de curta duração para essa função dentro da VM.
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Resposta
Criação de instância iniciada
Show child attributes
Show child attributes

