curl --request POST \
--url https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "update_egress_policy",
"params": {
"allowed_hostnames": [
"<string>"
],
"allowed_cidrs": [
"<string>"
]
}
}
'import requests
url = "https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions"
payload = {
"action": "update_egress_policy",
"params": {
"allowed_hostnames": ["<string>"],
"allowed_cidrs": ["<string>"]
}
}
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({
action: 'update_egress_policy',
params: {allowed_hostnames: ['<string>'], allowed_cidrs: ['<string>']}
})
};
fetch('https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions', 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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions",
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([
'action' => 'update_egress_policy',
'params' => [
'allowed_hostnames' => [
'<string>'
],
'allowed_cidrs' => [
'<string>'
]
]
]),
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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions"
payload := strings.NewReader("{\n \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions")
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 \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"state": "provisioning",
"last_mutation": {
"type": "create",
"status": "pending",
"error_code": "invalid_argument",
"message": "<string>",
"completed_at": "2023-11-07T05:31:56Z"
},
"applied": "immediate"
}
}{
"code": "Parameter.Invalid",
"message": "Invalid request parameters",
"request_id": "req-xxxx"
}{
"code": "Auth.Unauthorized",
"message": "Authentication required",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"trace_id": "<string>",
"details": {}
}{
"code": "Resource.NotFound",
"message": "The requested resource was not found",
"request_id": "req-xxxx"
}{
"code": "Resource.StateConflict",
"message": "Sandbox state conflict: current updating, required running",
"request_id": "req-xxxx",
"details": {
"state": "running",
"last_mutation": {
"type": "set_timeout",
"status": "failed",
"error_code": "invalid_argument",
"message": "timeout update rejected by runtime",
"completed_at": "2026-08-13T09:12:31Z"
}
}
}{
"code": "Template.ProviderNotSupported",
"message": "The selected IDC does not support this template operation",
"request_id": "req-xxxx"
}{
"code": "Request.Canceled",
"message": "Request canceled",
"request_id": "req-xxxx"
}{
"code": "Resource.StateConflict",
"message": "Sandbox state conflict: current updating, required running",
"request_id": "req-xxxx",
"details": {
"state": "running",
"last_mutation": {
"type": "set_timeout",
"status": "failed",
"error_code": "invalid_argument",
"message": "timeout update rejected by runtime",
"completed_at": "2026-08-13T09:12:31Z"
}
}
}{
"code": "Request.Timeout",
"message": "Request timed out",
"request_id": "req-xxxx"
}Execute a sandbox runtime action
Single dispatch endpoint for runtime actions on a running sandbox. Currently update_egress_policy is supported: it replaces the egress allowlist. Only a sandbox created with egress_control=true can be updated; the allowlist is a full replacement, not a merge.
applied=immediate means the change is already in effect (existing connections are not promised to drop); applied=eventual means the change is accepted and still propagating. A sandbox without egress_control returns 400.
Only a running sandbox accepts this call. paused and other transitional states return 409: a paused sandbox has no writable live network, and a resume does not replay a change submitted while paused — accepting the call would silently do nothing. Resume the sandbox first with POST /sandboxes/{id}/resume.
curl --request POST \
--url https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "update_egress_policy",
"params": {
"allowed_hostnames": [
"<string>"
],
"allowed_cidrs": [
"<string>"
]
}
}
'import requests
url = "https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions"
payload = {
"action": "update_egress_policy",
"params": {
"allowed_hostnames": ["<string>"],
"allowed_cidrs": ["<string>"]
}
}
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({
action: 'update_egress_policy',
params: {allowed_hostnames: ['<string>'], allowed_cidrs: ['<string>']}
})
};
fetch('https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions', 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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions",
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([
'action' => 'update_egress_policy',
'params' => [
'allowed_hostnames' => [
'<string>'
],
'allowed_cidrs' => [
'<string>'
]
]
]),
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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions"
payload := strings.NewReader("{\n \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\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://console.gmicloud.ai/api/v2/sandboxes/{id}/actions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.gmicloud.ai/api/v2/sandboxes/{id}/actions")
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 \"action\": \"update_egress_policy\",\n \"params\": {\n \"allowed_hostnames\": [\n \"<string>\"\n ],\n \"allowed_cidrs\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"state": "provisioning",
"last_mutation": {
"type": "create",
"status": "pending",
"error_code": "invalid_argument",
"message": "<string>",
"completed_at": "2023-11-07T05:31:56Z"
},
"applied": "immediate"
}
}{
"code": "Parameter.Invalid",
"message": "Invalid request parameters",
"request_id": "req-xxxx"
}{
"code": "Auth.Unauthorized",
"message": "Authentication required",
"request_id": "req-xxxx"
}{
"code": "Resource.QuotaExceeded",
"message": "The resource quota is not enough.",
"request_id": "req-xxxx",
"trace_id": "<string>",
"details": {}
}{
"code": "Resource.NotFound",
"message": "The requested resource was not found",
"request_id": "req-xxxx"
}{
"code": "Resource.StateConflict",
"message": "Sandbox state conflict: current updating, required running",
"request_id": "req-xxxx",
"details": {
"state": "running",
"last_mutation": {
"type": "set_timeout",
"status": "failed",
"error_code": "invalid_argument",
"message": "timeout update rejected by runtime",
"completed_at": "2026-08-13T09:12:31Z"
}
}
}{
"code": "Template.ProviderNotSupported",
"message": "The selected IDC does not support this template operation",
"request_id": "req-xxxx"
}{
"code": "Request.Canceled",
"message": "Request canceled",
"request_id": "req-xxxx"
}{
"code": "Resource.StateConflict",
"message": "Sandbox state conflict: current updating, required running",
"request_id": "req-xxxx",
"details": {
"state": "running",
"last_mutation": {
"type": "set_timeout",
"status": "failed",
"error_code": "invalid_argument",
"message": "timeout update rejected by runtime",
"completed_at": "2026-08-13T09:12:31Z"
}
}
}{
"code": "Request.Timeout",
"message": "Request timed out",
"request_id": "req-xxxx"
}Authorizations
API Key or Access Token, always sent as Authorization: Bearer <token>. The gateway recognizes the token type automatically.
Path Parameters
Unique sandbox resource ID (UUID; the id field of the create response). The data-plane key (sandbox_key) cannot be used here.