curl --request POST \
--url https://{sandbox_key}.{domain}/shell \
--header 'Content-Type: application/json' \
--header 'X-Access-Token: <api-key>' \
--data '{}'import requests
url = "https://{sandbox_key}.{domain}/shell"
payload = {}
headers = {
"X-Access-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Access-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{sandbox_key}.{domain}/shell', 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://{sandbox_key}.{domain}/shell",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Token: <api-key>"
],
]);
$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://{sandbox_key}.{domain}/shell"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Token", "<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://{sandbox_key}.{domain}/shell")
.header("X-Access-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{sandbox_key}.{domain}/shell")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"request_id": "req-7f3c",
"sandbox_key": "sandbox-key",
"status": "ready",
"connect_url": "/shell/connect"
}{
"request_id": "req-7f3c",
"sandbox_key": "sandbox-key",
"status": "creating",
"code": "Shell.Creating"
}{
"code": "Shell.InvalidRequest",
"message": "request body contains unknown field",
"request_id": "req-7f3c"
}{
"code": "Auth.Unauthorized",
"message": "unauthorized",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}Launch the sandbox interactive shell
Ensures the sandbox’s single logical shell (PTY) session exists. The call is
idempotent: if the shell already exists, it returns 200 with the current
status instead of creating a duplicate. The effective URL is the sandbox
data-plane host (https://{sandbox_key}.{domain}; both values, like the
X-Access-Token value, come from the control-plane create/connect response).
The endpoint does not include the control-plane /api/v2 prefix.
The request body must be empty or {}; unknown fields are rejected with
400 Shell.InvalidRequest.
On 200, connect_url is the relative path of the WebSocket attach
endpoint. The full attach address is
wss://{sandbox_key}.{domain}{connect_url} — the same host this request was
sent to, with the scheme switched to wss.
A 202 with code=Shell.Creating means another request is currently
creating the shell; retry POST /shell shortly — the retry never creates a
duplicate PTY.
curl --request POST \
--url https://{sandbox_key}.{domain}/shell \
--header 'Content-Type: application/json' \
--header 'X-Access-Token: <api-key>' \
--data '{}'import requests
url = "https://{sandbox_key}.{domain}/shell"
payload = {}
headers = {
"X-Access-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Access-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{sandbox_key}.{domain}/shell', 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://{sandbox_key}.{domain}/shell",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Token: <api-key>"
],
]);
$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://{sandbox_key}.{domain}/shell"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Token", "<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://{sandbox_key}.{domain}/shell")
.header("X-Access-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{sandbox_key}.{domain}/shell")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"request_id": "req-7f3c",
"sandbox_key": "sandbox-key",
"status": "ready",
"connect_url": "/shell/connect"
}{
"request_id": "req-7f3c",
"sandbox_key": "sandbox-key",
"status": "creating",
"code": "Shell.Creating"
}{
"code": "Shell.InvalidRequest",
"message": "request body contains unknown field",
"request_id": "req-7f3c"
}{
"code": "Auth.Unauthorized",
"message": "unauthorized",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Shell.NotFound",
"message": "<string>",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}Authorizations
Sandbox data-plane token — the sandbox_access_token returned by the create/connect endpoints. Used for /files, Sandbox-Exec, and other data-plane endpoints; the control plane (/api/v2) does not accept it, and conversely the control plane's Authorization: Bearer is invalid on the data plane.
The token is bound to its sandbox: using sandbox A's token against sandbox B's host fails. It stays valid until the sandbox's lifetime ends; there is no separate rotation endpoint (rotate_traffic_token rotates the port traffic token traffic_access_token and does not affect this one).
Headers
Body
Empty object. Any unknown field is rejected with 400 Shell.InvalidRequest.
Response
The shell exists (created by this call, or already present).
status=ready means the PTY exists and can be attached;
status=attached means the shell exists and currently has an
active WebSocket connection (a second attach would get 409).
Public status of the sandbox shell session.
creating: a launch is in progress (only appears with202).ready: the PTY exists and can be attached.attached: the shell exists and currently has an active WebSocket connection (a second attach would get409).closed: the shell has been terminated byaction=closeand can never be re-attached.
creating, ready, attached, closed Relative path of the WebSocket attach endpoint. The full attach
address is wss://{sandbox_key}.{domain}{connect_url} — the same
data-plane host this request was sent to, with the scheme switched
to wss. This is always the sandbox's own data-plane endpoint.
"/shell/connect"