curl --request POST \
--url https://api.example.com/v2/sandboxes/templates \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": [
"<string>"
],
"inject_headers": {},
"match_paths": [
"<string>"
],
"enabled": true
}
],
"no_proxy": [
"<string>"
]
}
}
'import requests
url = "https://api.example.com/v2/sandboxes/templates"
payload = {
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": ["<string>"],
"inject_headers": {},
"match_paths": ["<string>"],
"enabled": True
}
],
"no_proxy": ["<string>"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
image: '<string>',
resources: {cpu: '500m', memory: '512Mi', storage: '1Gi'},
volume_mounts: [{volume_name: '<string>', mount_path: '<string>'}],
proxy_config: {
rules: [
{
name: '<string>',
match_hosts: ['<string>'],
inject_headers: {},
match_paths: ['<string>'],
enabled: true
}
],
no_proxy: ['<string>']
}
})
};
fetch('https://api.example.com/v2/sandboxes/templates', 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.example.com/v2/sandboxes/templates",
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([
'name' => '<string>',
'image' => '<string>',
'resources' => [
'cpu' => '500m',
'memory' => '512Mi',
'storage' => '1Gi'
],
'volume_mounts' => [
[
'volume_name' => '<string>',
'mount_path' => '<string>'
]
],
'proxy_config' => [
'rules' => [
[
'name' => '<string>',
'match_hosts' => [
'<string>'
],
'inject_headers' => [
],
'match_paths' => [
'<string>'
],
'enabled' => true
]
],
'no_proxy' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v2/sandboxes/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v2/sandboxes/templates")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/sandboxes/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": [
"<string>"
],
"inject_headers": {},
"match_paths": [
"<string>"
],
"enabled": true
}
],
"no_proxy": [
"<string>"
]
},
"created_at": "<string>",
"updated_at": "<string>"
}{
"detail": {
"error": "BadRequest",
"message": "Error description."
}
}{
"detail": {
"error": "Conflict",
"message": "Resource already exists."
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create a SandboxTemplate
Create a new SandboxTemplate in tenant’s namespace.
curl --request POST \
--url https://api.example.com/v2/sandboxes/templates \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": [
"<string>"
],
"inject_headers": {},
"match_paths": [
"<string>"
],
"enabled": true
}
],
"no_proxy": [
"<string>"
]
}
}
'import requests
url = "https://api.example.com/v2/sandboxes/templates"
payload = {
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": ["<string>"],
"inject_headers": {},
"match_paths": ["<string>"],
"enabled": True
}
],
"no_proxy": ["<string>"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
image: '<string>',
resources: {cpu: '500m', memory: '512Mi', storage: '1Gi'},
volume_mounts: [{volume_name: '<string>', mount_path: '<string>'}],
proxy_config: {
rules: [
{
name: '<string>',
match_hosts: ['<string>'],
inject_headers: {},
match_paths: ['<string>'],
enabled: true
}
],
no_proxy: ['<string>']
}
})
};
fetch('https://api.example.com/v2/sandboxes/templates', 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.example.com/v2/sandboxes/templates",
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([
'name' => '<string>',
'image' => '<string>',
'resources' => [
'cpu' => '500m',
'memory' => '512Mi',
'storage' => '1Gi'
],
'volume_mounts' => [
[
'volume_name' => '<string>',
'mount_path' => '<string>'
]
],
'proxy_config' => [
'rules' => [
[
'name' => '<string>',
'match_hosts' => [
'<string>'
],
'inject_headers' => [
],
'match_paths' => [
'<string>'
],
'enabled' => true
]
],
'no_proxy' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/v2/sandboxes/templates"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v2/sandboxes/templates")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v2/sandboxes/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"image\": \"<string>\",\n \"resources\": {\n \"cpu\": \"500m\",\n \"memory\": \"512Mi\",\n \"storage\": \"1Gi\"\n },\n \"volume_mounts\": [\n {\n \"volume_name\": \"<string>\",\n \"mount_path\": \"<string>\"\n }\n ],\n \"proxy_config\": {\n \"rules\": [\n {\n \"name\": \"<string>\",\n \"match_hosts\": [\n \"<string>\"\n ],\n \"inject_headers\": {},\n \"match_paths\": [\n \"<string>\"\n ],\n \"enabled\": true\n }\n ],\n \"no_proxy\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"image": "<string>",
"resources": {
"cpu": "500m",
"memory": "512Mi",
"storage": "1Gi"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"volume_mounts": [
{
"volume_name": "<string>",
"mount_path": "<string>"
}
],
"proxy_config": {
"rules": [
{
"name": "<string>",
"match_hosts": [
"<string>"
],
"inject_headers": {},
"match_paths": [
"<string>"
],
"enabled": true
}
],
"no_proxy": [
"<string>"
]
},
"created_at": "<string>",
"updated_at": "<string>"
}{
"detail": {
"error": "BadRequest",
"message": "Error description."
}
}{
"detail": {
"error": "Conflict",
"message": "Resource already exists."
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
Request model for creating a SandboxTemplate.
Users can only configure the container image, resource limits, volume mounts, and optional proxy configuration. All other pod spec details are filled in with secure defaults.
Name of the template (max 63 chars, DNS-1035 format: lowercase alphanumeric and hyphens, must start with letter)
Container image to use for the sandbox
"python:3.12-slim"
"node:20-slim"
Resource limits for the sandbox
Show child attributes
Show child attributes
Optional list of volumes to mount in the sandbox
Show child attributes
Show child attributes
Optional proxy configuration for injecting secrets/headers into outbound HTTPS requests. When set, a smithbox-proxy sidecar will be deployed alongside the sandbox container.
Show child attributes
Show child attributes
Response
Successful Response
Response model for a SandboxTemplate.
Resource specification for a sandbox.
- ResourceSpec
- Resources
Show child attributes
Show child attributes
Unique template identifier
Specification for mounting a volume in a sandbox template.
- VolumeMountSpec · object[]
- Volume Mounts · object[]
Show child attributes
Show child attributes
Proxy configuration for a sandbox template.
When proxy_config is set, a smithbox-proxy sidecar will be deployed alongside the sandbox container to intercept HTTPS traffic and inject headers based on the configured rules.
- ProxyConfig
- Proxy Config
Show child attributes
Show child attributes
Was this page helpful?