curl --request POST \
--url https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Outerlayer-App-Id: <api-key>' \
--data '
{
"apis": [
"<string>"
],
"fromState": "<string>",
"idleMinutes": 123,
"metadata": {},
"timeLimitMinutes": 123,
"waits": true
}
'import requests
url = "https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox"
payload = {
"apis": ["<string>"],
"fromState": "<string>",
"idleMinutes": 123,
"metadata": {},
"timeLimitMinutes": 123,
"waits": True
}
headers = {
"X-Outerlayer-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Outerlayer-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
apis: ['<string>'],
fromState: '<string>',
idleMinutes: 123,
metadata: {},
timeLimitMinutes: 123,
waits: true
})
};
fetch('https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox', 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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox",
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([
'apis' => [
'<string>'
],
'fromState' => '<string>',
'idleMinutes' => 123,
'metadata' => [
],
'timeLimitMinutes' => 123,
'waits' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Outerlayer-App-Id: <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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox"
payload := strings.NewReader("{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Outerlayer-App-Id", "<api-key>")
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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox")
.header("X-Outerlayer-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Outerlayer-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"api": "header",
"dataPlaneUrl": "<string>",
"fromState": "<string>",
"id": "<string>",
"machine": "small",
"metadata": {},
"name": "<string>",
"providerNote": "<string>",
"secret": "<string>",
"snapshot": "<string>",
"state": "<string>",
"tokenHeader": "<string>",
"urlToken": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Create the managed sandbox of a schedule run a runner holds
Creates a sandbox on OuterLayer’s account at the sandbox provider for the schedule run the calling runner key or fleet machine holds, and answers with the sandbox’s address and secret. The sandbox is always the machine size small, whatever the factory’s build settings say, and has no direct network access. Its time limit is the run’s time limit: a longer timeLimitMinutes is lowered to it. The gateway chooses the snapshot: the base snapshot, or with fromState a saved state of the caller’s factory. A run uses one sandbox, and never keeps or resumes one or saves a state. The run’s time is billed as managed build-hours, at the size small, from the moment its sandbox has started to the end of the run, with a minimum of 60 seconds. A sandbox whose run ends, or whose lease lapses, is ended by the gateway. A run that has a sandbox gets that sandbox again. The limit on builds at one time never holds a run. Refusals: claim_expired (410, the run is not held by a live lease), claim_not_held (403), run_not_found (404), managed_sandboxes_unavailable (403), managed_build_held (409, with reason: trial_hours_used, spending_cap_reached or unavailable), sandbox_state_unusable (409, with reason), sandbox_provider_busy (503) and sandbox_provider_refused (502). A refused call makes no sandbox. The response is sent with Cache-Control: no-store.
curl --request POST \
--url https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Outerlayer-App-Id: <api-key>' \
--data '
{
"apis": [
"<string>"
],
"fromState": "<string>",
"idleMinutes": 123,
"metadata": {},
"timeLimitMinutes": 123,
"waits": true
}
'import requests
url = "https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox"
payload = {
"apis": ["<string>"],
"fromState": "<string>",
"idleMinutes": 123,
"metadata": {},
"timeLimitMinutes": 123,
"waits": True
}
headers = {
"X-Outerlayer-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Outerlayer-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
apis: ['<string>'],
fromState: '<string>',
idleMinutes: 123,
metadata: {},
timeLimitMinutes: 123,
waits: true
})
};
fetch('https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox', 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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox",
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([
'apis' => [
'<string>'
],
'fromState' => '<string>',
'idleMinutes' => 123,
'metadata' => [
],
'timeLimitMinutes' => 123,
'waits' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Outerlayer-App-Id: <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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox"
payload := strings.NewReader("{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Outerlayer-App-Id", "<api-key>")
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://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox")
.header("X-Outerlayer-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.outerlayer.ai/v1/schedule-runs/{runId}/sandbox")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Outerlayer-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apis\": [\n \"<string>\"\n ],\n \"fromState\": \"<string>\",\n \"idleMinutes\": 123,\n \"metadata\": {},\n \"timeLimitMinutes\": 123,\n \"waits\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"api": "header",
"dataPlaneUrl": "<string>",
"fromState": "<string>",
"id": "<string>",
"machine": "small",
"metadata": {},
"name": "<string>",
"providerNote": "<string>",
"secret": "<string>",
"snapshot": "<string>",
"state": "<string>",
"tokenHeader": "<string>",
"urlToken": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Headers
Body
The forms the runner can call a sandbox in besides header, such as helper. The gateway makes a new sandbox at the first provider in its order whose sandboxes the runner can call, and at the next one when that provider refuses with a fault that can clear. Absent, the runner gets only sandboxes of the form header.
832The id of a saved state of the caller's factory (save-managed-sandbox-state) to make the sandbox from, instead of the base snapshot. The state is read only for a new sandbox: a claim that has a sandbox gets that sandbox, whatever this names. A state that cannot be used gets sandbox_state_unusable (409, with reason), and nothing is bound. It does not apply to a resume.
Set true when the runner can wait for a sandbox that is still starting. The gateway then answers 200 with the sandbox in the state starting, and the runner reads it until it has started. Absent, the gateway answers only with a sandbox that has started, and a sandbox that is still starting gets sandbox_provider_refused (502). It does not apply to a resume.