Skip to main content
POST
/
process
Execute a command
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Process execution request

command
string
required
Example:

"ls -la"

env
object
Example:
{ "{\"PORT\"": " \"3000\"}" }
keepAlive
boolean

Disable scale-to-zero while process runs. Default timeout is 600s (10 minutes). Set timeout to 0 for infinite.

Example:

false

maxRestarts
integer

Maximum number of restarts on failure. Set to a negative value (e.g. -1) for unlimited restarts.

Example:

3

name
string
Example:

"my-process"

restartOnFailure
boolean
Example:

true

timeout
integer

Timeout in seconds. When keepAlive is true, defaults to 600s (10 minutes). Set to 0 for infinite (no auto-kill).

Example:

30

waitForCompletion
boolean
Example:

false

waitForPorts
integer[]
Example:
[3000, 8080]
workingDir
string
Example:

"/home/user"

Response

Process information

command
string
required
Example:

"ls -la"

completedAt
string
required
Example:

"Wed, 01 Jan 2023 12:01:00 GMT"

exitCode
integer
required
Example:

0

logs
string
required
Example:

"logs output"

name
string
required
Example:

"my-process"

pid
string
required
Example:

"1234"

startedAt
string
required
Example:

"Wed, 01 Jan 2023 12:00:00 GMT"

status
enum<string>
required
Available options:
failed,
killed,
stopped,
running,
completed
Example:

"running"

stderr
string
required
Example:

"stderr output"

stdout
string
required
Example:

"stdout output"

workingDir
string
required
Example:

"/home/user"

keepAlive
boolean

Whether scale-to-zero is disabled for this process

Example:

false

maxRestarts
integer
Example:

3

restartCount
integer
Example:

2

restartOnFailure
boolean
Example:

true

Last modified on June 17, 2026