Skip to content
Hoody.com

The Script Templates API exposes the container’s template engine: list available templates (built-in and custom), preview a template with variable substitution, generate executable code from a template, and create, update, or delete custom user-supplied templates stored in _hoody/templates/. Use these endpoints when integrating template-driven automation or building tooling that needs to inspect or extend the available script scaffolds.

Returns the set of available templates. Built-in and custom templates are both included by default; pass query parameters to narrow the result set by category or to exclude either source.

NameInTypeRequiredDescription
categoryquerystringNoFilter templates to a single metadata category (e.g. api, utility). Omit to list all categories.
includeBuiltinquerybooleanNoInclude built-in templates in the result set. Default true. Accepts true/false/1/0.
includeCustomquerybooleanNoInclude user-supplied templates (from _hoody/templates/) in the result set. Default true.
Terminal window
curl -X GET "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/list?includeBuiltin=true&includeCustom=true"

Renders a template with optional variable substitution and returns both the substituted and original source. Useful for previewing what a generated script will look like before invoking the generate endpoint.

NameInTypeRequiredDescription
namequerystringYesName of the template to preview.
variablesquerystringNoJSON-encoded object of variables to substitute into the template body.
Terminal window
curl -X GET "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/preview?name=api-fetch&variables=%7B%22url%22%3A%22https%3A%2F%2Fapi.example.com%22%7D"

Creates a new custom template in the container’s _hoody/templates/ directory. The endpoint returns the persisted metadata so the caller can confirm what was written.

This endpoint accepts a JSON request payload. The body schema is intentionally open-ended by the server and does not define specific fields.

{}
Terminal window
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/create-custom" \
-H "Content-Type: application/json" \
-d '{}'

Generates executable code from a named template by substituting the supplied variables. Optionally writes the result to disk if saveFile is true.

NameTypeRequiredDescription
namestringYesName of the template to generate.
variablesobjectNoVariable values to substitute into the template.
outputPathstringNoFilesystem path to write the generated code to when saveFile is true.
saveFilebooleanNoWhen true, persists the generated code to outputPath. Default false.
Terminal window
curl -X POST "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/generate" \
-H "Content-Type: application/json" \
-d '{
"name": "api-fetch",
"variables": {
"url": "https://api.example.com/users",
"method": "GET"
},
"outputPath": "/tmp/fetch.sh",
"saveFile": false
}'

PUT /api/v1/exec/templates/update-custom/{name}

Section titled “PUT /api/v1/exec/templates/update-custom/{name}”

Updates an existing custom template. The supplied metadata object is merged with the existing metadata; supply code to replace the template source.

NameInTypeRequiredDescription
namepathstringYesName of the custom template to update.
NameTypeRequiredDescription
codestringNoNew template source. Omit to leave unchanged.
metadataobjectNoMetadata fields to merge into the existing template metadata.
Terminal window
curl -X PUT "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/update-custom/log-rotator" \
-H "Content-Type: application/json" \
-d '{
"code": "find {{logDir}} -name \"*.log\" -mtime +{{days}} -exec rm {} \\;",
"metadata": {
"version": "1.1.0",
"description": "Delete log files older than N days (safe rm)."
}
}'

DELETE /api/v1/exec/templates/delete-custom/{name}

Section titled “DELETE /api/v1/exec/templates/delete-custom/{name}”

Removes a custom template from _hoody/templates/. Built-in templates cannot be deleted through this endpoint.

NameInTypeRequiredDescription
namepathstringYesName of the custom template to delete.
Terminal window
curl -X DELETE "https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.icu/api/v1/exec/templates/delete-custom/log-rotator"