Templates ›
Rename template
PATCH
/v1/templates/{id}Renames a template, or changes its tags and metadata, or both. A new name changes nothing else. Its tags and metadata are every sandbox's on it, at once, running or not, without a restart: GET /v1/sandboxes/{id} shows them. A key a sandbox sets itself wins over the template's.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const template = await agental.templates.get("tpl_0123456789abcdef");
- await template.rename("ci-2");
Answer200 OK · 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 changed.
Path
idrequiredstring | e.g. "tpl_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
namestring | Its new name. Left out, it keeps its name. |
tagsarray of string | Its tags, in place of the ones it has: every sandbox on it has them at once. An empty list removes them. A sandbox's own tags stay. e.g. ["run-7f3a","branch-auth"] |
metadataobject | Merged into its metadata: a key with a value is set, a key with null is removed. Every sandbox on it has the change at once, except for a key it sets itself, which stays as it set it. e.g. {"branch":"claude/auth-refresh","ticket":null} |
Returns
200 Template changed.
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. |
| 409 | default_template default keeps its name. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.