curl --request PATCH \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id} \
--header 'Content-Type: application/json' \
--data '
{
"docker_compose_file": "<string>",
"pre_launch_script": "<string>",
"allowed_envs": [
"<string>"
],
"public_logs": true,
"public_sysinfo": true,
"public_tcbinfo": true,
"compose": {
"secure_time": true,
"swap_size": "<string>",
"storage_discard": true,
"gateway_enabled": true,
"port_policy": {
"ports": [
{
"port": 123,
"pp": false
}
],
"restrict_mode": false
},
"requirements": {
"ephemeral_data_disk": true,
"health_check": true,
"health_status_file": "<string>",
"launch_token_hash": "<string>",
"platforms": [
"<string>"
],
"tdx_measure_acpi_tables": true
},
"bash_script": "<string>",
"kms_enabled": true,
"key_provider_id": "<string>",
"local_key_provider_enabled": true,
"manifest_version": 123,
"no_instance_id": true,
"runner": "<string>",
"verity_volumes": [
{
"source": "<string>",
"target": "<string>",
"verity_root": "<string>"
}
],
"tproxy_enabled": true,
"features": [
"<string>"
]
},
"init_scripts": [],
"confirm_data_wipe": false,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"instance_type": "<string>",
"image": "<string>",
"shutdown_timeout": 605,
"allow_force_stop": false
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}"
payload = {
"docker_compose_file": "<string>",
"pre_launch_script": "<string>",
"allowed_envs": ["<string>"],
"public_logs": True,
"public_sysinfo": True,
"public_tcbinfo": True,
"compose": {
"secure_time": True,
"swap_size": "<string>",
"storage_discard": True,
"gateway_enabled": True,
"port_policy": {
"ports": [
{
"port": 123,
"pp": False
}
],
"restrict_mode": False
},
"requirements": {
"ephemeral_data_disk": True,
"health_check": True,
"health_status_file": "<string>",
"launch_token_hash": "<string>",
"platforms": ["<string>"],
"tdx_measure_acpi_tables": True
},
"bash_script": "<string>",
"kms_enabled": True,
"key_provider_id": "<string>",
"local_key_provider_enabled": True,
"manifest_version": 123,
"no_instance_id": True,
"runner": "<string>",
"verity_volumes": [
{
"source": "<string>",
"target": "<string>",
"verity_root": "<string>"
}
],
"tproxy_enabled": True,
"features": ["<string>"]
},
"init_scripts": [],
"confirm_data_wipe": False,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"instance_type": "<string>",
"image": "<string>",
"shutdown_timeout": 605,
"allow_force_stop": False
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
docker_compose_file: '<string>',
pre_launch_script: '<string>',
allowed_envs: ['<string>'],
public_logs: true,
public_sysinfo: true,
public_tcbinfo: true,
compose: {
secure_time: true,
swap_size: '<string>',
storage_discard: true,
gateway_enabled: true,
port_policy: {ports: [{port: 123, pp: false}], restrict_mode: false},
requirements: {
ephemeral_data_disk: true,
health_check: true,
health_status_file: '<string>',
launch_token_hash: '<string>',
platforms: ['<string>'],
tdx_measure_acpi_tables: true
},
bash_script: '<string>',
kms_enabled: true,
key_provider_id: '<string>',
local_key_provider_enabled: true,
manifest_version: 123,
no_instance_id: true,
runner: '<string>',
verity_volumes: [{source: '<string>', target: '<string>', verity_root: '<string>'}],
tproxy_enabled: true,
features: ['<string>']
},
init_scripts: [],
confirm_data_wipe: false,
encrypted_env: '<string>',
user_config: '<string>',
gpus: {gpus: [{slot: '<string>', product_id: '<string>'}], attach_mode: 'listed'},
vcpu: 123,
memory: 123,
disk_size: 123,
instance_type: '<string>',
image: '<string>',
shutdown_timeout: 605,
allow_force_stop: false
})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}', 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://cloud-api.phala.com/api/v1/cvms/{cvm_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'docker_compose_file' => '<string>',
'pre_launch_script' => '<string>',
'allowed_envs' => [
'<string>'
],
'public_logs' => true,
'public_sysinfo' => true,
'public_tcbinfo' => true,
'compose' => [
'secure_time' => true,
'swap_size' => '<string>',
'storage_discard' => true,
'gateway_enabled' => true,
'port_policy' => [
'ports' => [
[
'port' => 123,
'pp' => false
]
],
'restrict_mode' => false
],
'requirements' => [
'ephemeral_data_disk' => true,
'health_check' => true,
'health_status_file' => '<string>',
'launch_token_hash' => '<string>',
'platforms' => [
'<string>'
],
'tdx_measure_acpi_tables' => true
],
'bash_script' => '<string>',
'kms_enabled' => true,
'key_provider_id' => '<string>',
'local_key_provider_enabled' => true,
'manifest_version' => 123,
'no_instance_id' => true,
'runner' => '<string>',
'verity_volumes' => [
[
'source' => '<string>',
'target' => '<string>',
'verity_root' => '<string>'
]
],
'tproxy_enabled' => true,
'features' => [
'<string>'
]
],
'init_scripts' => [
],
'confirm_data_wipe' => false,
'encrypted_env' => '<string>',
'user_config' => '<string>',
'gpus' => [
'gpus' => [
[
'slot' => '<string>',
'product_id' => '<string>'
]
],
'attach_mode' => 'listed'
],
'vcpu' => 123,
'memory' => 123,
'disk_size' => 123,
'instance_type' => '<string>',
'image' => '<string>',
'shutdown_timeout' => 605,
'allow_force_stop' => false
]),
CURLOPT_HTTPHEADER => [
"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://cloud-api.phala.com/api/v1/cvms/{cvm_id}"
payload := strings.NewReader("{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}")
.header("Content-Type", "application/json")
.body("{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update CVM
Unified PATCH endpoint for CVM updates. Only fields present in the request body are applied. Handles resource resize, compose configuration, visibility, environment, and OS image updates. For contract-owned KMS, compose-hash-affecting changes require two-phase flow with on-chain hash registration.
curl --request PATCH \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id} \
--header 'Content-Type: application/json' \
--data '
{
"docker_compose_file": "<string>",
"pre_launch_script": "<string>",
"allowed_envs": [
"<string>"
],
"public_logs": true,
"public_sysinfo": true,
"public_tcbinfo": true,
"compose": {
"secure_time": true,
"swap_size": "<string>",
"storage_discard": true,
"gateway_enabled": true,
"port_policy": {
"ports": [
{
"port": 123,
"pp": false
}
],
"restrict_mode": false
},
"requirements": {
"ephemeral_data_disk": true,
"health_check": true,
"health_status_file": "<string>",
"launch_token_hash": "<string>",
"platforms": [
"<string>"
],
"tdx_measure_acpi_tables": true
},
"bash_script": "<string>",
"kms_enabled": true,
"key_provider_id": "<string>",
"local_key_provider_enabled": true,
"manifest_version": 123,
"no_instance_id": true,
"runner": "<string>",
"verity_volumes": [
{
"source": "<string>",
"target": "<string>",
"verity_root": "<string>"
}
],
"tproxy_enabled": true,
"features": [
"<string>"
]
},
"init_scripts": [],
"confirm_data_wipe": false,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"instance_type": "<string>",
"image": "<string>",
"shutdown_timeout": 605,
"allow_force_stop": false
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}"
payload = {
"docker_compose_file": "<string>",
"pre_launch_script": "<string>",
"allowed_envs": ["<string>"],
"public_logs": True,
"public_sysinfo": True,
"public_tcbinfo": True,
"compose": {
"secure_time": True,
"swap_size": "<string>",
"storage_discard": True,
"gateway_enabled": True,
"port_policy": {
"ports": [
{
"port": 123,
"pp": False
}
],
"restrict_mode": False
},
"requirements": {
"ephemeral_data_disk": True,
"health_check": True,
"health_status_file": "<string>",
"launch_token_hash": "<string>",
"platforms": ["<string>"],
"tdx_measure_acpi_tables": True
},
"bash_script": "<string>",
"kms_enabled": True,
"key_provider_id": "<string>",
"local_key_provider_enabled": True,
"manifest_version": 123,
"no_instance_id": True,
"runner": "<string>",
"verity_volumes": [
{
"source": "<string>",
"target": "<string>",
"verity_root": "<string>"
}
],
"tproxy_enabled": True,
"features": ["<string>"]
},
"init_scripts": [],
"confirm_data_wipe": False,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"instance_type": "<string>",
"image": "<string>",
"shutdown_timeout": 605,
"allow_force_stop": False
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
docker_compose_file: '<string>',
pre_launch_script: '<string>',
allowed_envs: ['<string>'],
public_logs: true,
public_sysinfo: true,
public_tcbinfo: true,
compose: {
secure_time: true,
swap_size: '<string>',
storage_discard: true,
gateway_enabled: true,
port_policy: {ports: [{port: 123, pp: false}], restrict_mode: false},
requirements: {
ephemeral_data_disk: true,
health_check: true,
health_status_file: '<string>',
launch_token_hash: '<string>',
platforms: ['<string>'],
tdx_measure_acpi_tables: true
},
bash_script: '<string>',
kms_enabled: true,
key_provider_id: '<string>',
local_key_provider_enabled: true,
manifest_version: 123,
no_instance_id: true,
runner: '<string>',
verity_volumes: [{source: '<string>', target: '<string>', verity_root: '<string>'}],
tproxy_enabled: true,
features: ['<string>']
},
init_scripts: [],
confirm_data_wipe: false,
encrypted_env: '<string>',
user_config: '<string>',
gpus: {gpus: [{slot: '<string>', product_id: '<string>'}], attach_mode: 'listed'},
vcpu: 123,
memory: 123,
disk_size: 123,
instance_type: '<string>',
image: '<string>',
shutdown_timeout: 605,
allow_force_stop: false
})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}', 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://cloud-api.phala.com/api/v1/cvms/{cvm_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'docker_compose_file' => '<string>',
'pre_launch_script' => '<string>',
'allowed_envs' => [
'<string>'
],
'public_logs' => true,
'public_sysinfo' => true,
'public_tcbinfo' => true,
'compose' => [
'secure_time' => true,
'swap_size' => '<string>',
'storage_discard' => true,
'gateway_enabled' => true,
'port_policy' => [
'ports' => [
[
'port' => 123,
'pp' => false
]
],
'restrict_mode' => false
],
'requirements' => [
'ephemeral_data_disk' => true,
'health_check' => true,
'health_status_file' => '<string>',
'launch_token_hash' => '<string>',
'platforms' => [
'<string>'
],
'tdx_measure_acpi_tables' => true
],
'bash_script' => '<string>',
'kms_enabled' => true,
'key_provider_id' => '<string>',
'local_key_provider_enabled' => true,
'manifest_version' => 123,
'no_instance_id' => true,
'runner' => '<string>',
'verity_volumes' => [
[
'source' => '<string>',
'target' => '<string>',
'verity_root' => '<string>'
]
],
'tproxy_enabled' => true,
'features' => [
'<string>'
]
],
'init_scripts' => [
],
'confirm_data_wipe' => false,
'encrypted_env' => '<string>',
'user_config' => '<string>',
'gpus' => [
'gpus' => [
[
'slot' => '<string>',
'product_id' => '<string>'
]
],
'attach_mode' => 'listed'
],
'vcpu' => 123,
'memory' => 123,
'disk_size' => 123,
'instance_type' => '<string>',
'image' => '<string>',
'shutdown_timeout' => 605,
'allow_force_stop' => false
]),
CURLOPT_HTTPHEADER => [
"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://cloud-api.phala.com/api/v1/cvms/{cvm_id}"
payload := strings.NewReader("{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}")
.header("Content-Type", "application/json")
.body("{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"docker_compose_file\": \"<string>\",\n \"pre_launch_script\": \"<string>\",\n \"allowed_envs\": [\n \"<string>\"\n ],\n \"public_logs\": true,\n \"public_sysinfo\": true,\n \"public_tcbinfo\": true,\n \"compose\": {\n \"secure_time\": true,\n \"swap_size\": \"<string>\",\n \"storage_discard\": true,\n \"gateway_enabled\": true,\n \"port_policy\": {\n \"ports\": [\n {\n \"port\": 123,\n \"pp\": false\n }\n ],\n \"restrict_mode\": false\n },\n \"requirements\": {\n \"ephemeral_data_disk\": true,\n \"health_check\": true,\n \"health_status_file\": \"<string>\",\n \"launch_token_hash\": \"<string>\",\n \"platforms\": [\n \"<string>\"\n ],\n \"tdx_measure_acpi_tables\": true\n },\n \"bash_script\": \"<string>\",\n \"kms_enabled\": true,\n \"key_provider_id\": \"<string>\",\n \"local_key_provider_enabled\": true,\n \"manifest_version\": 123,\n \"no_instance_id\": true,\n \"runner\": \"<string>\",\n \"verity_volumes\": [\n {\n \"source\": \"<string>\",\n \"target\": \"<string>\",\n \"verity_root\": \"<string>\"\n }\n ],\n \"tproxy_enabled\": true,\n \"features\": [\n \"<string>\"\n ]\n },\n \"init_scripts\": [],\n \"confirm_data_wipe\": false,\n \"encrypted_env\": \"<string>\",\n \"user_config\": \"<string>\",\n \"gpus\": {\n \"gpus\": [\n {\n \"slot\": \"<string>\",\n \"product_id\": \"<string>\"\n }\n ],\n \"attach_mode\": \"listed\"\n },\n \"vcpu\": 123,\n \"memory\": 123,\n \"disk_size\": 123,\n \"instance_type\": \"<string>\",\n \"image\": \"<string>\",\n \"shutdown_timeout\": 605,\n \"allow_force_stop\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
Compose hash from Phase 1 response (Phase 2 only)
Transaction hash proving on-chain registration (Phase 2 only)
When 'true', generate a commit token for multisig workflows instead of expecting immediate on-chain registration
Path Parameters
Body
PATCH request body — all fields optional, only set fields are applied.
Docker Compose YAML content
Shell script executed before containers start
Allowed environment variable names (env_keys)
Expose container logs publicly
Expose system info publicly
Expose TCB attestation info publicly
JSON Merge Patch of the app compose
Show child attributes
Show child attributes
Platform init scripts this CVM runs, replacing the current set. Enabling docker_cleanup requires confirm_data_wipe.
docker_cleanup, env_merge Confirms turning on docker_cleanup or requirements.ephemeral_data_disk, which erase data on every boot.
Encrypted environment variables as hex string
User configuration string
GPU configuration
Show child attributes
Show child attributes
Number of vCPUs
Memory in MB
Disk size in GB
Instance type identifier (e.g. tdx.medium)
OS image name or slug from available-os-images
Timeout in seconds for graceful shutdown. null uses the platform default.
10 <= x <= 1200When true, skips graceful shutdown and force stops the CVM immediately.
Response
Update initiated, track via correlation_id
Was this page helpful?

