Sandboxes
Run Command in Sandbox
Submits a shell command to a running sandbox. By default the response
reports running after the runtime accepts it. Set wait=true to hold
for a terminal result; if the wait budget expires, the response remains
running and the result is available from getSandboxExec. Only
running sandboxes accept execs (409 otherwise).
POST
/
api
/
sandboxes
/
{sid}
/
execs
Run a command in a sandbox
curl --request POST \
--url https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"command_tty": true,
"env": {},
"timeout_seconds": 123
}
'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs"
payload = {
"command": "<string>",
"command_tty": True,
"env": {},
"timeout_seconds": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: '<string>', command_tty: true, env: {}, timeout_seconds: 123})
};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs', 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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs",
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([
'command' => '<string>',
'command_tty' => true,
'env' => [
],
'timeout_seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"sandbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"exec_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"command": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"exit_reason": "<string>",
"execute_time_ms": 123,
"finished_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}Authorizations
API key
Path Parameters
Sandbox UUID
Query Parameters
Hold the request for a completed start or exec result
Body
application/json
Was this page helpful?
⌘I
Run a command in a sandbox
curl --request POST \
--url https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "<string>",
"command_tty": true,
"env": {},
"timeout_seconds": 123
}
'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs"
payload = {
"command": "<string>",
"command_tty": True,
"env": {},
"timeout_seconds": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: '<string>', command_tty: true, env: {}, timeout_seconds: 123})
};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs', 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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs",
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([
'command' => '<string>',
'command_tty' => true,
'env' => [
],
'timeout_seconds' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs"
payload := strings.NewReader("{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/sandboxes/{sid}/execs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"<string>\",\n \"command_tty\": true,\n \"env\": {},\n \"timeout_seconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"sandbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"exec_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"command": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"exit_reason": "<string>",
"execute_time_ms": 123,
"finished_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}