curl --request POST \
--url https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la",
"env": {
"{\"PORT\"": " \"3000\"}"
},
"keepAlive": false,
"maxRestarts": 3,
"name": "my-process",
"restartOnFailure": true,
"timeout": 30,
"waitForCompletion": false,
"waitForPorts": [
3000,
8080
],
"workingDir": "/home/user"
}
'import requests
url = "https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process"
payload = {
"command": "ls -la",
"env": { "{"PORT"": " \"3000\"}" },
"keepAlive": False,
"maxRestarts": 3,
"name": "my-process",
"restartOnFailure": True,
"timeout": 30,
"waitForCompletion": False,
"waitForPorts": [3000, 8080],
"workingDir": "/home/user"
}
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({
command: 'ls -la',
env: {'{"PORT"': ' "3000"}'},
keepAlive: false,
maxRestarts: 3,
name: 'my-process',
restartOnFailure: true,
timeout: 30,
waitForCompletion: false,
waitForPorts: [3000, 8080],
workingDir: '/home/user'
})
};
fetch('https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process', 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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process",
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' => 'ls -la',
'env' => [
'{"PORT"' => ' "3000"}'
],
'keepAlive' => false,
'maxRestarts' => 3,
'name' => 'my-process',
'restartOnFailure' => true,
'timeout' => 30,
'waitForCompletion' => false,
'waitForPorts' => [
3000,
8080
],
'workingDir' => '/home/user'
]),
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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process"
payload := strings.NewReader("{\n \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process")
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 \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\n}"
response = http.request(request)
puts response.read_body{
"command": "ls -la",
"completedAt": "Wed, 01 Jan 2023 12:01:00 GMT",
"exitCode": 0,
"logs": "logs output",
"name": "my-process",
"pid": "1234",
"startedAt": "Wed, 01 Jan 2023 12:00:00 GMT",
"status": "running",
"stderr": "stderr output",
"stdout": "stdout output",
"workingDir": "/home/user",
"keepAlive": false,
"maxRestarts": 3,
"restartCount": 2,
"restartOnFailure": true
}{
"error": "Error message"
}{
"error": "Error message"
}{
"error": "Error message"
}Execute a command
Execute a command and return process information. If Accept header is text/event-stream, streams logs in SSE format and returns the process response as a final event.
curl --request POST \
--url https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la",
"env": {
"{\"PORT\"": " \"3000\"}"
},
"keepAlive": false,
"maxRestarts": 3,
"name": "my-process",
"restartOnFailure": true,
"timeout": 30,
"waitForCompletion": false,
"waitForPorts": [
3000,
8080
],
"workingDir": "/home/user"
}
'import requests
url = "https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process"
payload = {
"command": "ls -la",
"env": { "{"PORT"": " \"3000\"}" },
"keepAlive": False,
"maxRestarts": 3,
"name": "my-process",
"restartOnFailure": True,
"timeout": 30,
"waitForCompletion": False,
"waitForPorts": [3000, 8080],
"workingDir": "/home/user"
}
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({
command: 'ls -la',
env: {'{"PORT"': ' "3000"}'},
keepAlive: false,
maxRestarts: 3,
name: 'my-process',
restartOnFailure: true,
timeout: 30,
waitForCompletion: false,
waitForPorts: [3000, 8080],
workingDir: '/home/user'
})
};
fetch('https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process', 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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process",
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' => 'ls -la',
'env' => [
'{"PORT"' => ' "3000"}'
],
'keepAlive' => false,
'maxRestarts' => 3,
'name' => 'my-process',
'restartOnFailure' => true,
'timeout' => 30,
'waitForCompletion' => false,
'waitForPorts' => [
3000,
8080
],
'workingDir' => '/home/user'
]),
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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process"
payload := strings.NewReader("{\n \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\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://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sbx-{sandbox_id}-{workspace_id}.{region}.bl.run/process")
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 \"command\": \"ls -la\",\n \"env\": {\n \"{\\\"PORT\\\"\": \" \\\"3000\\\"}\"\n },\n \"keepAlive\": false,\n \"maxRestarts\": 3,\n \"name\": \"my-process\",\n \"restartOnFailure\": true,\n \"timeout\": 30,\n \"waitForCompletion\": false,\n \"waitForPorts\": [\n 3000,\n 8080\n ],\n \"workingDir\": \"/home/user\"\n}"
response = http.request(request)
puts response.read_body{
"command": "ls -la",
"completedAt": "Wed, 01 Jan 2023 12:01:00 GMT",
"exitCode": 0,
"logs": "logs output",
"name": "my-process",
"pid": "1234",
"startedAt": "Wed, 01 Jan 2023 12:00:00 GMT",
"status": "running",
"stderr": "stderr output",
"stdout": "stdout output",
"workingDir": "/home/user",
"keepAlive": false,
"maxRestarts": 3,
"restartCount": 2,
"restartOnFailure": true
}{
"error": "Error message"
}{
"error": "Error message"
}{
"error": "Error message"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Process execution request
"ls -la"
Show child attributes
Show child attributes
{ "{\"PORT\"": " \"3000\"}" }
Disable scale-to-zero while process runs. Default timeout is 600s (10 minutes). Set timeout to 0 for infinite.
false
3
"my-process"
true
Timeout in seconds. When keepAlive is true, defaults to 600s (10 minutes). Set to 0 for infinite (no auto-kill).
30
false
[3000, 8080]
"/home/user"
Response
Process information
"ls -la"
"Wed, 01 Jan 2023 12:01:00 GMT"
0
"logs output"
"my-process"
"1234"
"Wed, 01 Jan 2023 12:00:00 GMT"
failed, killed, stopped, running, completed "running"
"stderr output"
"stdout output"
"/home/user"
Whether scale-to-zero is disabled for this process
false
3
2
true
Was this page helpful?
