Templates ›
Create template
POST
/v1/templatesMakes a template with nothing in it but the tags and metadata sent. Its start is the default's size and a new machine.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const template = await agental.templates.create("ci");
Answer201 Created · Template
- {
- "id": string,
- "name": string,
- "default": boolean,
- "start": {
- "size": "tiny" | "small" | "medium" | "large",
- "snapshotId": string | null,
- "ttlSeconds": integer | null,
- },
- "variables": string[],
- "hidden": string[],
- "files": string[],
- "network": {
- "outbound": "open" | "blocked" | "allowlist",
- "allow": string[],
- },
- "ssh": {
- "enabled": boolean,
- "enabledAt": string | null,
- "keys": SshKey[],
- },
- … 6 more
- }
Template made.
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
namerequiredstring | |
tagsarray of string | Tags every sandbox made on it, or put on it, has. Left out, none. e.g. ["run-7f3a","branch-auth"] |
metadataobject | Metadata every sandbox on it has, for the keys it does not set itself. Left out, none. e.g. {"repo":"honzabit/agental","customer_id":"cus_0042"} |
Returns
201 Template made.
Template15 fields
idstring
namestring
defaultboolean
Whether this is the account's default: the template a sandbox is on when none is chosen.
More
It cannot be deleted or renamed.startTemplateStart3 fields
sizetinysmallmediumlarge
The size a sandbox made from the template is, when the create names none.
snapshotIdstringnull
The snapshot a sandbox made from the template starts as, when the create names none.
More
Null starts a new machine.ttlSecondsintegernull
Seconds a sandbox made from the template runs after each start before it is stopped, when the create names none.
More
Null is the deployment's default.variablesstring[]
The names of its variables.
More
A value is read one at a time.hiddenstring[]
Of its variables, the ones kept out of the sandbox.
filesstring[]
The paths of its secret files.
More
Contents are read one at a time.networkTemplateNetwork2 fields
outboundopenblockedallowlist
What a sandbox on the template may reach outside itself, before its own addresses.
More
open is the internet, which is what a sandbox has when nothing is asked. blocked lets nothing out: names still resolve, and no connection leaves. allowlist lets out only what goes to an address in allow. It is enforced outside the sandbox, on the server it runs on, so nothing running in the sandbox can change it, root included. What reaches the sandbox is not affected: commands, files and its public addresses work as before. Whatever this says, no sandbox reaches another sandbox or a private network, or delivers mail on port 25.allowstring[]
The IPv4 addresses and ranges an allowlist lets out to, over any protocol and port.
More
Empty for open and blocked.sshTemplateSsh3 fields
enabledboolean
Whether a sandbox made from the template has SSH turned on as it is made, as PUT /v1/sandboxes/{id}/ssh would: GET /v1/sandboxes/{id}/ssh then says where to connect.
enabledAtstringnull
keysSshKey[]4 fields
The public keys let in to a sandbox's machine as it is made, as POST /v1/sandboxes/{id}/ssh/keys would, in the order they were added.
More
At most 50.idstring
What the key is named by when it is removed: the SHA-256 of the key, written so that it can stand in a path.
fingerprintstring
The same, as ssh-keygen -l prints it.
typestring
commentstringnull
What follows the key on its line.
More
Null when nothing does.revisioninteger
Raised by every change to its variables, files and outbound rule.
More
A sandbox that has it at another revision is not up to date with it.sandboxesinteger
How many sandboxes are on it.
tagsstring[]
Tags every sandbox on it has, on top of its own.
More
A change reaches them all at once, running or not.metadataobject
Metadata every sandbox on it has, for the keys it does not set itself.
More
A change reaches them all at once, running or not.createdAtstring
updatedAtstring
Errors and other answers
| 400 | invalid_request the name, path or value is not one that can be kept. |
| 400 | invalid_path the path leads out of the working folder. |
| 404 | Not found. |
| 409 | name_taken the account has a template of that name, or the name is default. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.