API reference · Pods
Save a pod’s configuration as a template (secrets are dropped from public ones)
/v1/pods/{pod_id}/templates- TypeScript
client.pods.saveAsTemplate()- Python
client.pods.save_as_template()- CLI
hayonix pods save-template
Creates a template from the pod’s image, command, ports, environment, container disk, volume size and mount path and SSH setting. Network volumes are never saved; a public template also leaves out secret references and the registry credential. omitted lists what was left out.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the template:create permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS "$API_BASE_URL/pods/pod_01jc5zq4m8k3v6x9t2w7r0b1e4/templates" \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "My notebook setup",
"visibility": "private"
}'Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Idempotency-Key | no | Makes a retry safe: the same key and request within 24 hours return the original response (see Idempotency). The SDKs send one for you. |
Path parameters
pod_idstringrequiredID of the pod
ID with prefix pod_
Body
JSON (application/json): SaveAsTemplateRequest.
namestringrequiredIts name
1–100 characters
descriptionstring | nullFree-text description
up to 1000 characters
visibilitystring`private`: every project of your organization can use it. `public`: every organization can; secret references and the registry credential are left out.
One of
privatepublicdefault "private"
Response
201 JSON — The new template and what it left out
objectstringrequiredAlways `template`: the type of this object
One of
templateidstringrequiredUnique ID (`tpl_…`)
ID with prefix tpl_
sourcestringrequired`official`: provided by the platform. `public`: shared by an organization with everyone. `private`: your organization’s own.
One of
officialpublicprivateorg_idstring | nullrequiredNull for official templates
namestringrequiredIts name
descriptionstring | nullrequiredFree-text description
imagestringrequiredContainer image reference
requires_gpubooleanrequiredNeeds a GPU SKU (e.g. built on CUDA)
readmestring | nullrequiredUsage notes (Markdown); null when there are none
registry_credential_idstring | nullrequiredID of the registry credential
ShowHide 9 fields of
defaultscommandarray of stringReplaces the image’s entrypoint when non-empty
up to 64 items · default []
argsarray of stringReplaces the image’s default arguments when non-empty
up to 256 items · default []
envarray of objectValues may contain {{random_token}}, replaced with a fresh random token for each pod
up to 128 items · default []
ShowHide 2 fields of
envnamestringrequiredIts name
pattern ^[A-Za-z_][A-Za-z0-9_]{0,127}$
valuestringrequiredValue of the variable (up to 32,768 characters)
up to 32768 characters
secret_envarray of objectPrivate templates only; dropped from public ones
up to 128 items · default []
ShowHide 2 fields of
secret_envnamestringrequiredIts name
pattern ^[A-Za-z_][A-Za-z0-9_]{0,127}$
secret_idstringrequiredID of the secret
ID with prefix sec_
portsarray of objectContainer ports each pod exposes
up to 16 items · default []
ShowHide 4 fields of
portsportintegerrequiredPort number the container listens on
1–65535
protocolstring`http`: served at the port’s HTTPS URL (WebSocket included). `tcp`: raw TCP, reachable through SSH port forwarding.
One of
httptcpdefault "http"
visibilitystring`public`: anyone with the URL. `private`: no URL; SSH port forwarding and the project network only.
One of
publicprivatedefault "public"
namestringIts name
pattern ^[a-z][a-z0-9-]{0,30}$
container_disk_gbintegerWritable container disk in GB for each pod
5–500 · default 20
volumeobject | nullPod volume created with each pod (null: none)
default null
ShowHide 2 fields of
volumesize_gbintegerrequiredSize in GB
1–2000
mount_pathstringrequiredAbsolute path the volume is mounted at inside the container
2–256 characters
sshbooleanAllow SSH (and SFTP, port forwarding) with the project’s SSH keys
default true
categorystringGrouping shown in the catalog: `base`, `notebook`, `ml` or `other`
One of
basenotebookmlotherdefault "other"
created_atstring (date-time)requiredWhen it was created (ISO 8601, UTC)
updated_atstring (date-time)requiredWhen it last changed (ISO 8601, UTC)
deleted_atstring (date-time) | nullrequiredWhen it was deleted (null while it exists) (ISO 8601, UTC)
omittedarray of stringrequiredPod settings not saved: `network_volumes`, and for a public template `secret_env` and `registry_credential_id` (each only when the pod has it)
Example response
{
"object": "template",
"id": "tpl_01jc5zq4m8k3v6x9t2w7r0b1e4",
"source": "official",
"org_id": "string",
"name": "string",
"description": "string",
"image": "string",
"requires_gpu": true,
"readme": "string",
"registry_credential_id": "string",
"defaults": {
"command": [],
"args": [],
"env": [],
"secret_env": [],
"ports": [],
"container_disk_gb": 20,
"volume": null,
"ssh": true,
"category": "other"
},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"deleted_at": "2026-01-01T00:00:00.000Z",
"omitted": [
"string"
]
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
409 | conflict_error | The resource's current state does not allow this. |
409 | conflict_error idempotency_in_progress | A request with the same Idempotency-Key is still running. |
422 | idempotency_error idempotency_key_reused | The Idempotency-Key was used with a different request. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |