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,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"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,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"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,
encrypted_env: '<string>',
user_config: '<string>',
gpus: {gpus: [{slot: '<string>', product_id: '<string>'}], attach_mode: 'listed'},
vcpu: 123,
memory: 123,
disk_size: 123,
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,
'encrypted_env' => '<string>',
'user_config' => '<string>',
'gpus' => [
'gpus' => [
[
'slot' => '<string>',
'product_id' => '<string>'
]
],
'attach_mode' => 'listed'
],
'vcpu' => 123,
'memory' => 123,
'disk_size' => 123,
'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 \"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 \"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 \"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 \"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 \"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 \"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,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"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,
"encrypted_env": "<string>",
"user_config": "<string>",
"gpus": {
"gpus": [
{
"slot": "<string>",
"product_id": "<string>"
}
],
"attach_mode": "listed"
},
"vcpu": 123,
"memory": 123,
"disk_size": 123,
"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,
encrypted_env: '<string>',
user_config: '<string>',
gpus: {gpus: [{slot: '<string>', product_id: '<string>'}], attach_mode: 'listed'},
vcpu: 123,
memory: 123,
disk_size: 123,
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,
'encrypted_env' => '<string>',
'user_config' => '<string>',
'gpus' => [
'gpus' => [
[
'slot' => '<string>',
'product_id' => '<string>'
]
],
'attach_mode' => 'listed'
],
'vcpu' => 123,
'memory' => 123,
'disk_size' => 123,
'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 \"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 \"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 \"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 \"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 \"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 \"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
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 MB
OS image name or slug from available-os-images
Timeout in seconds for graceful shutdown. null means no timeout.
10 <= x <= 1200When true, falls back to hard stop if graceful shutdown times out. Use for zombie CVMs that are unresponsive to shutdown signals.
Response
Update initiated, track via correlation_id
Was this page helpful?

