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"
}
}Crear una instancia
Crear una nueva instancia de cómputo
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 permisos de computación para obtener la lista completa, lo que cubre cada una y un ejemplo de directiva.Autorizaciones
Un token bearer de OAuth 2.0, enviado como Authorization: Bearer <token>. Esta es la forma recomendada de autenticación.
Obtén el token intercambiando el par de claves de acceso de una cuenta de servicio en POST /v1/oauth/token con grant_type=client_credentials. Es el flujo estándar de credenciales de cliente; las bibliotecas compatibles con OAuth pueden obtener y renovar el token por ti.
curl -s -u "$KEY_ID:$SECRET" -d grant_type=client_credentials \
https://iam.basaltic.sh/v1/oauth/token
Los tokens duran una hora por defecto. El mismo par de claves de acceso también sirve como credencial AWS SigV4 para el endpoint de objetos compatible con S3, que solo acepta ese método de autenticación.
Encabezados
Clave opcional generada por el cliente que hace que una creación sea segura para la reproducción. Al volver a intentar una solicitud con la misma clave, se devuelve el resultado original literalmente en lugar de crear un recurso duplicado. Se rechaza la reutilización de una clave con un cuerpo de solicitud diferente (422); una solicitud cuya clave todavía se está procesando devuelve 409. Los registros se mantienen durante 24 horas. Usa un UUID o un token único similar.
255Cuerpo
Los nombres de los recursos no deben comenzar con el prefijo literal crn: ni ser UUID (en cualquier caso, en las formas canónica, compacta, entre corchetes o urn:uuid:).
1 - 255"web-01"
Referencia de tipo de instancia regional (UUID, CRN o nombre exacto)
"550e8400-e29b-41d4-a716-446655440000"
Interfaces a adjuntar, al menos una. El índice 0 es la NIC primaria.
Se requiere porque una instancia sin interfaz arranca sin ninguna red, y nada dentro de ella puede agregar una después.
1Show child attributes
Show child attributes
1000"Primary web server"
Arquitectura para nombres de imagen y etiquetas name:version (por defecto amd64); un CRN fija su propia arquitectura y versión.
Imagen desde la que clonar el disco de arranque. Se requiere a menos que volumes contenga un volumen de arranque existente; no se puede combinar con un volumen de arranque existente. Se aceptan cuatro formas: una imagen completa/nombre/arquitectura/arquitectura/versión/CRN de versión; un id de imagen; name:version, que fija una compilación y es la forma de optar por no incluir la etiqueta que se mueve debajo de usted; o un name sin contenido, que sigue la etiqueta a cualquier compilación que esté vigente cuando se crea la instancia. Los nombres prefieren una compilación utilizable de propiedad del llamador sobre una compilación etiquetada del catálogo de plataformas para la arquitectura solicitada (por defecto amd64). Un CRN identifica al propietario, nombre, arquitectura y versión. La resolución nunca reintenta otro tipo de referencia; las respuestas y las plantillas almacenadas conservan el UUID de imagen resuelto.
"debian-13"
Discos nuevos o existentes vinculados con la instancia, el disco de arranque incluido — marque con boot: true. Como máximo una entrada puede.
Omita la entrada de arranque para tomar el tamaño mínimo de la imagen y el nivel predeterminado de la región.
Cree un nuevo disco, opcionalmente con rendimiento aprovisionado, o adjunte un volumen disponible existente en esta cuenta y región mediante volume. Los volúmenes existentes conservan su contenido, rendimiento y programaciones de instantáneas; se conservan después de un error de inicio o eliminación de instancia. Requiere compute:AttachVolume para discos existentes. Un volumen solo puede ocurrir una vez. Un disco de arranque existente debe ser arrancable y reemplaza la imagen de nivel 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" }
Datos de usuario codificados en Base64 (cloud-init)
"I2Nsb3VkLWNvbmZpZwpwYWNrYWdlczoKICAtIG5naW54Cg=="
Adjunte un rol de IAM de la misma cuenta por UUID, CRN o nombre exacto. La directiva de confianza del rol debe permitir crn:compute:*:*:instance/* (o el CRN de la instancia específica). El extremo IMDS de la instancia (169.254.169.254) mantiene las credenciales de STS de corta duración para este rol desde dentro de la máquina virtual.
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Respuesta
Creación de instancia iniciada
Show child attributes
Show child attributes

