Set or rotate the app launch token
curl --request POST \
--url https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token \
--header 'Content-Type: application/json' \
--data '
{
"launch_token": "<string>"
}
'import requests
url = "https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token"
payload = { "launch_token": "<string>" }
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({launch_token: '<string>'})
};
fetch('https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token', 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/apps/{app_id}/launch-token",
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([
'launch_token' => '<string>'
]),
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/apps/{app_id}/launch-token"
payload := strings.NewReader("{\n \"launch_token\": \"<string>\"\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/apps/{app_id}/launch-token")
.header("Content-Type", "application/json")
.body("{\n \"launch_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token")
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 \"launch_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"launch_token": "<string>",
"launch_token_hash": "<string>"
}Apps
Set or rotate the app launch token
Sets the app’s launch token, generating one when the body omits it, and returns the plaintext and its hash once. CVMs keep booting with their current compose: update each CVM’s requirements.launch_token_hash to the returned hash before its next boot, or it fails closed. Phala Cloud and the node operator can read the token, so it protects only against parties who know the public compose.
POST
/
api
/
v1
/
apps
/
{app_id}
/
launch-token
Set or rotate the app launch token
curl --request POST \
--url https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token \
--header 'Content-Type: application/json' \
--data '
{
"launch_token": "<string>"
}
'import requests
url = "https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token"
payload = { "launch_token": "<string>" }
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({launch_token: '<string>'})
};
fetch('https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token', 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/apps/{app_id}/launch-token",
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([
'launch_token' => '<string>'
]),
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/apps/{app_id}/launch-token"
payload := strings.NewReader("{\n \"launch_token\": \"<string>\"\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/apps/{app_id}/launch-token")
.header("Content-Type", "application/json")
.body("{\n \"launch_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.phala.com/api/v1/apps/{app_id}/launch-token")
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 \"launch_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"launch_token": "<string>",
"launch_token_hash": "<string>"
}Path Parameters
Hex app identifier
Body
application/json
Token to set (at least 32 bytes). Omit to have Phala Cloud generate one.
Was this page helpful?

