Skip to main content
POST
Create a template

Authorizations

Authorization
string
header
required

An API key that starts with vms_. Make one in Settings > API keys.

Body

application/json
name
string
required

A name that is unique in the workspace: 1 to 63 lowercase letters, digits, and hyphens. It cannot start or end with a hyphen.

Pattern: ^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$
Example:

"node-22-base"

fromSandbox
string
required

The ID of a running or stopped sandbox. For a running sandbox, the template takes a new snapshot first, so that it has the latest writes.

Minimum string length: 1
Example:

"sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"

Response

The new template, with the status saving.

id
string
required
Example:

"tpl_06d8k3m7q2v9x4b1n5c0e8f2ja"

name
string
required
Example:

"node-22-base"

status
enum<string>
required

saving while the template takes a snapshot of the sandbox. ready when you can create sandboxes from it. failed if the save did not complete.

Available options:
saving,
ready,
failed
size
enum<string>
required

The size of the sandbox at the save.

Available options:
small,
medium,
large,
xlarge
sourceSandboxId
string | null
required

The sandbox that the template was saved from. The template does not change when this sandbox changes or is deleted.

Example:

"sbx_06d8k3m7q2v9x4b1n5c0e8f2ja"

storedBytes
integer | null
required

The compressed size of the saved files. Null until the template is ready.

Required range: 0 <= x <= 9007199254740991
error
object | null
required

Why the save failed. Null if it did not fail.

readyAt
string<date-time> | null
required
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))$
createdAt
string<date-time>
required
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))$
updatedAt
string<date-time>
required
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))$