Create a template
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'node-22-base', fromSandbox: 'sbx_06d8k3m7q2v9x4b1n5c0e8f2ja'})
};
fetch('https://vms.dev/api/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://vms.dev/api/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "node-22-base",
"fromSandbox": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"
}
'import requests
url = "https://vms.dev/api/v1/templates"
payload = {
"name": "node-22-base",
"fromSandbox": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "tpl_06d8k3m7q2v9x4b1n5c0e8f2ja",
"name": "node-22-base",
"status": "saving",
"size": "small",
"sourceSandboxId": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja",
"storedBytes": 4503599627370495,
"error": {
"code": "<string>",
"message": "<string>"
},
"readyAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}Templates
Create a template
Saves the files of a running or stopped sandbox as a template. The template has the status saving, then ready or failed. For a running sandbox, the template takes a new snapshot first, so that it has the latest writes. The template is a full copy: it does not change when the sandbox changes or is deleted, and it has no expiry date. Needs the templates:write and the snapshots:read scopes, because a template copies the files of the sandbox.
POST
/
v1
/
templates
Create a template
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'node-22-base', fromSandbox: 'sbx_06d8k3m7q2v9x4b1n5c0e8f2ja'})
};
fetch('https://vms.dev/api/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://vms.dev/api/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "node-22-base",
"fromSandbox": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"
}
'import requests
url = "https://vms.dev/api/v1/templates"
payload = {
"name": "node-22-base",
"fromSandbox": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "tpl_06d8k3m7q2v9x4b1n5c0e8f2ja",
"name": "node-22-base",
"status": "saving",
"size": "small",
"sourceSandboxId": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja",
"storedBytes": 4503599627370495,
"error": {
"code": "<string>",
"message": "<string>"
},
"readyAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}Authorizations
Body
application/json
Response
The new template, with the status saving.
Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$