curl --request POST \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy \
--header 'Content-Type: application/json' \
--data '
{
"encrypted_env": "<string>",
"allow_env_mismatch": false
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy"
payload = {
"encrypted_env": "<string>",
"allow_env_mismatch": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({encrypted_env: '<string>', allow_env_mismatch: false})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy', 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}/revisions/{revision_id}/redeploy",
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([
'encrypted_env' => '<string>',
'allow_env_mismatch' => 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}/revisions/{revision_id}/redeploy"
payload := strings.NewReader("{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy")
.header("Content-Type", "application/json")
.body("{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}"
response = http.request(request)
puts response.read_body{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Redeploy CVM from a specific revision
Switch/rollback a CVM to a specified app revision (compose_hash). Does not change encrypted env unless encrypted_env is supplied. A mismatch between allowed_envs and the last env write is rejected unless encrypted_env is supplied or allow_env_mismatch is true.
curl --request POST \
--url https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy \
--header 'Content-Type: application/json' \
--data '
{
"encrypted_env": "<string>",
"allow_env_mismatch": false
}
'import requests
url = "https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy"
payload = {
"encrypted_env": "<string>",
"allow_env_mismatch": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({encrypted_env: '<string>', allow_env_mismatch: false})
};
fetch('https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy', 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}/revisions/{revision_id}/redeploy",
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([
'encrypted_env' => '<string>',
'allow_env_mismatch' => 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}/revisions/{revision_id}/redeploy"
payload := strings.NewReader("{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}")
req, _ := http.NewRequest("POST", 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.post("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy")
.header("Content-Type", "application/json")
.body("{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/cvms/{cvm_id}/revisions/{revision_id}/redeploy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"encrypted_env\": \"<string>\",\n \"allow_env_mismatch\": false\n}"
response = http.request(request)
puts response.read_body{
"error_code": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": null,
"message": "<string>"
}
],
"suggestions": [
"<string>"
],
"links": [
{
"url": "<string>",
"label": "<string>"
}
],
"request_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Path Parameters
External AppRevisionId (prefix 'rev_'). Fully prefixed string required; bare payloads and raw integers are rejected.
"rev_0123abcd"
Query Parameters
Optional transaction hash proving on-chain compose hash registration
Body
Optional encrypted env blob. When omitted, rollback keeps the CVM's current encrypted env. Supply a blob only to deliberately roll env back.
Continue even when this revision's allowed_envs differ from the last env write. Ignored when encrypted_env is supplied.
Response
Activation initiated
Was this page helpful?

