Start
Server-streaming RPC. Use the Connect protocol with streaming support.
curl --request POST \
--url https://sandbox.{domain}/process.Process/Start \
--header 'Authorization: Basic <encoded-value>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/connect+json' \
--header 'E2b-Sandbox-Id: <e2b-sandbox-id>' \
--header 'E2b-Sandbox-Port: <e2b-sandbox-port>' \
--header 'X-Access-Token: <api-key>' \
--data '
{
"process": {
"cmd": "<string>",
"args": [
"<string>"
],
"envs": {},
"cwd": "<string>"
},
"pty": {
"size": {
"cols": 123,
"rows": 123
}
},
"tag": "<string>",
"stdin": true
}
'import requests
url = "https://sandbox.{domain}/process.Process/Start"
payload = {
"process": {
"cmd": "<string>",
"args": ["<string>"],
"envs": {},
"cwd": "<string>"
},
"pty": { "size": {
"cols": 123,
"rows": 123
} },
"tag": "<string>",
"stdin": True
}
headers = {
"Connect-Protocol-Version": "<connect-protocol-version>",
"E2b-Sandbox-Id": "<e2b-sandbox-id>",
"E2b-Sandbox-Port": "<e2b-sandbox-port>",
"X-Access-Token": "<api-key>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/connect+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
'E2b-Sandbox-Id': '<e2b-sandbox-id>',
'E2b-Sandbox-Port': '<e2b-sandbox-port>',
'X-Access-Token': '<api-key>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/connect+json'
},
body: JSON.stringify({
process: {cmd: '<string>', args: ['<string>'], envs: {}, cwd: '<string>'},
pty: {size: {cols: 123, rows: 123}},
tag: '<string>',
stdin: true
})
};
fetch('https://sandbox.{domain}/process.Process/Start', 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.{domain}/process.Process/Start",
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([
'process' => [
'cmd' => '<string>',
'args' => [
'<string>'
],
'envs' => [
],
'cwd' => '<string>'
],
'pty' => [
'size' => [
'cols' => 123,
'rows' => 123
]
],
'tag' => '<string>',
'stdin' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/connect+json",
"E2b-Sandbox-Id: <e2b-sandbox-id>",
"E2b-Sandbox-Port: <e2b-sandbox-port>",
"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.{domain}/process.Process/Start"
payload := strings.NewReader("{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("E2b-Sandbox-Id", "<e2b-sandbox-id>")
req.Header.Add("E2b-Sandbox-Port", "<e2b-sandbox-port>")
req.Header.Add("X-Access-Token", "<api-key>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/connect+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.{domain}/process.Process/Start")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("E2b-Sandbox-Id", "<e2b-sandbox-id>")
.header("E2b-Sandbox-Port", "<e2b-sandbox-port>")
.header("X-Access-Token", "<api-key>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/connect+json")
.body("{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.{domain}/process.Process/Start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["E2b-Sandbox-Id"] = '<e2b-sandbox-id>'
request["E2b-Sandbox-Port"] = '<e2b-sandbox-port>'
request["X-Access-Token"] = '<api-key>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/connect+json'
request.body = "{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}"
response = http.request(request)
puts response.read_body{
"event": {
"data": {
"pty": "aSDinaTvuI8gbWludGxpZnk="
}
}
}{
"message": "<string>",
"code": 123,
"sandboxID": "<string>"
}Authorizations
Sandbox access token (envdAccessToken) for authenticating requests to a running sandbox. Returned by: POST /sandboxes (on create), POST /sandboxes/{sandboxID}/connect (on connect), POST /sandboxes/{sandboxID}/resume (on resume), and GET /sandboxes/{sandboxID} (for running or paused sandboxes).
Optional system user for the operation. Sets file ownership and resolves relative paths. Pass the desired username with no password. Defaults to the sandbox's default user when omitted.
Headers
Define the version of the Connect protocol
Define the timeout, in ms
Identifier of the target sandbox. Routes the request to that sandbox's envd over the shared sandbox host.
Port envd listens on inside the sandbox (default 49983).
Body
Response
Stream of StartResponse events
- event
- event
- event
- event
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://sandbox.{domain}/process.Process/Start \
--header 'Authorization: Basic <encoded-value>' \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/connect+json' \
--header 'E2b-Sandbox-Id: <e2b-sandbox-id>' \
--header 'E2b-Sandbox-Port: <e2b-sandbox-port>' \
--header 'X-Access-Token: <api-key>' \
--data '
{
"process": {
"cmd": "<string>",
"args": [
"<string>"
],
"envs": {},
"cwd": "<string>"
},
"pty": {
"size": {
"cols": 123,
"rows": 123
}
},
"tag": "<string>",
"stdin": true
}
'import requests
url = "https://sandbox.{domain}/process.Process/Start"
payload = {
"process": {
"cmd": "<string>",
"args": ["<string>"],
"envs": {},
"cwd": "<string>"
},
"pty": { "size": {
"cols": 123,
"rows": 123
} },
"tag": "<string>",
"stdin": True
}
headers = {
"Connect-Protocol-Version": "<connect-protocol-version>",
"E2b-Sandbox-Id": "<e2b-sandbox-id>",
"E2b-Sandbox-Port": "<e2b-sandbox-port>",
"X-Access-Token": "<api-key>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/connect+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
'E2b-Sandbox-Id': '<e2b-sandbox-id>',
'E2b-Sandbox-Port': '<e2b-sandbox-port>',
'X-Access-Token': '<api-key>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/connect+json'
},
body: JSON.stringify({
process: {cmd: '<string>', args: ['<string>'], envs: {}, cwd: '<string>'},
pty: {size: {cols: 123, rows: 123}},
tag: '<string>',
stdin: true
})
};
fetch('https://sandbox.{domain}/process.Process/Start', 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.{domain}/process.Process/Start",
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([
'process' => [
'cmd' => '<string>',
'args' => [
'<string>'
],
'envs' => [
],
'cwd' => '<string>'
],
'pty' => [
'size' => [
'cols' => 123,
'rows' => 123
]
],
'tag' => '<string>',
'stdin' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/connect+json",
"E2b-Sandbox-Id: <e2b-sandbox-id>",
"E2b-Sandbox-Port: <e2b-sandbox-port>",
"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.{domain}/process.Process/Start"
payload := strings.NewReader("{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("E2b-Sandbox-Id", "<e2b-sandbox-id>")
req.Header.Add("E2b-Sandbox-Port", "<e2b-sandbox-port>")
req.Header.Add("X-Access-Token", "<api-key>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/connect+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.{domain}/process.Process/Start")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("E2b-Sandbox-Id", "<e2b-sandbox-id>")
.header("E2b-Sandbox-Port", "<e2b-sandbox-port>")
.header("X-Access-Token", "<api-key>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/connect+json")
.body("{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.{domain}/process.Process/Start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["E2b-Sandbox-Id"] = '<e2b-sandbox-id>'
request["E2b-Sandbox-Port"] = '<e2b-sandbox-port>'
request["X-Access-Token"] = '<api-key>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/connect+json'
request.body = "{\n \"process\": {\n \"cmd\": \"<string>\",\n \"args\": [\n \"<string>\"\n ],\n \"envs\": {},\n \"cwd\": \"<string>\"\n },\n \"pty\": {\n \"size\": {\n \"cols\": 123,\n \"rows\": 123\n }\n },\n \"tag\": \"<string>\",\n \"stdin\": true\n}"
response = http.request(request)
puts response.read_body{
"event": {
"data": {
"pty": "aSDinaTvuI8gbWludGxpZnk="
}
}
}{
"message": "<string>",
"code": 123,
"sandboxID": "<string>"
}