Create a sandbox from a template
curl --request POST \
--url https://api.styne.ai/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"templateID": "<string>",
"snapshot": "<string>",
"image": "<string>",
"timeout": 123,
"idleTimeout": 1800,
"autoPause": true,
"autoResume": true,
"lifecycle": {
"autoResume": true
},
"secure": true,
"allow_internet_access": true,
"network": {
"allowPublicTraffic": true,
"allowOut": [
"<string>"
],
"denyOut": [
"<string>"
],
"maskRequestHost": "<string>"
},
"metadata": {},
"envVars": {},
"environment": "<string>",
"vcpus": 123,
"memory_mib": 123,
"volumeMounts": [
{
"name": "<string>",
"path": "<string>",
"readOnly": true
}
]
}
'import requests
url = "https://api.styne.ai/sandboxes"
payload = {
"templateID": "<string>",
"snapshot": "<string>",
"image": "<string>",
"timeout": 123,
"idleTimeout": 1800,
"autoPause": True,
"autoResume": True,
"lifecycle": { "autoResume": True },
"secure": True,
"allow_internet_access": True,
"network": {
"allowPublicTraffic": True,
"allowOut": ["<string>"],
"denyOut": ["<string>"],
"maskRequestHost": "<string>"
},
"metadata": {},
"envVars": {},
"environment": "<string>",
"vcpus": 123,
"memory_mib": 123,
"volumeMounts": [
{
"name": "<string>",
"path": "<string>",
"readOnly": True
}
]
}
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({
templateID: '<string>',
snapshot: '<string>',
image: '<string>',
timeout: 123,
idleTimeout: 1800,
autoPause: true,
autoResume: true,
lifecycle: {autoResume: true},
secure: true,
allow_internet_access: true,
network: {
allowPublicTraffic: true,
allowOut: ['<string>'],
denyOut: ['<string>'],
maskRequestHost: '<string>'
},
metadata: {},
envVars: {},
environment: '<string>',
vcpus: 123,
memory_mib: 123,
volumeMounts: [{name: '<string>', path: '<string>', readOnly: true}]
})
};
fetch('https://api.styne.ai/sandboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 123,
"message": "<string>",
"error_code": "<string>",
"origin": "<string>",
"request_id": "<string>"
}Create a sandbox from a template
POST
/
sandboxes
Create a sandbox from a template
curl --request POST \
--url https://api.styne.ai/sandboxes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"templateID": "<string>",
"snapshot": "<string>",
"image": "<string>",
"timeout": 123,
"idleTimeout": 1800,
"autoPause": true,
"autoResume": true,
"lifecycle": {
"autoResume": true
},
"secure": true,
"allow_internet_access": true,
"network": {
"allowPublicTraffic": true,
"allowOut": [
"<string>"
],
"denyOut": [
"<string>"
],
"maskRequestHost": "<string>"
},
"metadata": {},
"envVars": {},
"environment": "<string>",
"vcpus": 123,
"memory_mib": 123,
"volumeMounts": [
{
"name": "<string>",
"path": "<string>",
"readOnly": true
}
]
}
'import requests
url = "https://api.styne.ai/sandboxes"
payload = {
"templateID": "<string>",
"snapshot": "<string>",
"image": "<string>",
"timeout": 123,
"idleTimeout": 1800,
"autoPause": True,
"autoResume": True,
"lifecycle": { "autoResume": True },
"secure": True,
"allow_internet_access": True,
"network": {
"allowPublicTraffic": True,
"allowOut": ["<string>"],
"denyOut": ["<string>"],
"maskRequestHost": "<string>"
},
"metadata": {},
"envVars": {},
"environment": "<string>",
"vcpus": 123,
"memory_mib": 123,
"volumeMounts": [
{
"name": "<string>",
"path": "<string>",
"readOnly": True
}
]
}
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({
templateID: '<string>',
snapshot: '<string>',
image: '<string>',
timeout: 123,
idleTimeout: 1800,
autoPause: true,
autoResume: true,
lifecycle: {autoResume: true},
secure: true,
allow_internet_access: true,
network: {
allowPublicTraffic: true,
allowOut: ['<string>'],
denyOut: ['<string>'],
maskRequestHost: '<string>'
},
metadata: {},
envVars: {},
environment: '<string>',
vcpus: 123,
memory_mib: 123,
volumeMounts: [{name: '<string>', path: '<string>', readOnly: true}]
})
};
fetch('https://api.styne.ai/sandboxes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 123,
"message": "<string>",
"error_code": "<string>",
"origin": "<string>",
"request_id": "<string>"
}Authorizations
Body
application/json
Create a sandbox. Name a template (templateID), a saved snapshot (snapshot) or a size; with none of them the default size is used.
Response
Success. The answer is described on https://docs.styne.ai/quickstart.