Skip to main content

Templates

Templates store reusable workload configurations. The manifest field uses the same shape as Create Workload; manifest.type must match the template type.

These /templates resources are distinct from sandbox templates. Use /sandbox-templates for templates published from Sandboxes.

All template endpoints are scoped to an organization. Replace {org_slug} with your organization slug.

Authentication​

Authorization: Bearer <YOUR_API_TOKEN>

Create Template​

POST /tha/v3/orgs/{org_slug}/templates

FieldTypeDescription
namestringRequired. Template name
descriptionstringOptional description
typestringRequired. Workload type (e.g. VM)
manifestobjectRequired. Full create-workload body; manifest.type must equal type

Example​

curl -X POST https://api.targon.com/tha/v3/orgs/{org_slug}/templates \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "confidential-vm",
"type": "VM",
"manifest": {
"type": "VM",
"name": "confidential-vm",
"image": "<vm-image-name>",
"resource_name": "h200-small",
"vm_config": {
"hostname": "confidential-vm"
}
}
}'

Response​

{ "uid": "tpl-abc123def456" }

List Templates​

GET /tha/v3/orgs/{org_slug}/templates

QueryTypeDescription
limitintegerMax items
cursorstringPagination cursor
typestringFilter by workload type
visibilitystringFilter by visibility: PUBLIC or PRIVATE. Defaults to both.

Each item: uid, name, description, type, manifest (raw JSON), visibility.


Get Template​

GET /tha/v3/orgs/{org_slug}/templates/{template_uid}

Returns the full Template object including created_at and updated_at.


Update Template​

PATCH /tha/v3/orgs/{org_slug}/templates/{template_uid}

Optional fields: name, description, manifest.


Delete Template​

DELETE /tha/v3/orgs/{org_slug}/templates/{template_uid}

Returns 204 No Content.