The Script Templates API lets you browse built-in and custom templates, preview them with substituted variables, generate scripts on the fly, and manage your own custom templates stored under _hoody/templates/. Use these endpoints when you want to scaffold new scripts from a known-good starting point or curate a private library of reusable templates for your container.
All template operations target the exec service in your container. Output scripts are written under /hoody/storage/hoody-exec/scripts; the outputPath you pass to generate is relative to that scripts root and must carry the host/exec scope itself (for example, default/1/fetch-items.ts).
Returns the catalog of templates available to this container. Built-in templates ship with the platform; custom templates are user-supplied files in _hoody/templates/. Use category to narrow the result to a single metadata bucket.
Name In Type Required Description categoryquery string No Filter templates to a single metadata category (e.g. api, utility). Omit to list all categories. includeBuiltinquery boolean No Include built-in templates in the result set. Default true. Accepts true/false/1/0. includeCustomquery boolean No Include user-supplied templates (from _hoody/templates/) in the result set. Default true.
" name " : " api-fetch-items " ,
" name " : " utility-format-date " ,
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X GET " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/list?includeBuiltin=true&includeCustom=true " \
-H " Authorization: Bearer $HOODY_TOKEN "
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . list ({ includeBuiltin : true , includeCustom : true });
Renders a template with optional variable substitution without writing a script file. Use this to inspect what a template produces (code) versus the raw template body (originalCode) and whether placeholders have been resolved (substituted).
Name In Type Required Description namequery string Yes Name query parameter variablesquery string No Variables query parameter
" name " : " api-fetch-items " ,
" tags " : [ " fetch " , " items " ],
" description " : " Fetches items from a configured API endpoint " ,
" params " : [ " url " , " method " ]
" code " : " // resolved code with variables substituted \n export async function main() { \n const url = 'https://api.example.com/items'; \n const method = 'GET'; \n return await fetch(url, { method }); \n } \n " ,
" originalCode " : " // raw template with placeholders \n export async function main() { \n const url = '{{url}}'; \n const method = '{{method}}'; \n return await fetch(url, { method }); \n } \n " ,
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Template not found " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution NOT_FOUNDResource not found The requested resource does not exist Verify the resource identifier
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X GET " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/preview?name=api-fetch-items&variables=%7B%22url%22%3A%22https%3A%2F%2Fapi.example.com%2Fitems%22%2C%22method%22%3A%22GET%22%7D " \
-H " Authorization: Bearer $HOODY_TOKEN "
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . preview ({
variables : ' {"url":"https://api.example.com/items","method":"GET"} '
Persists a new user-supplied template under _hoody/templates/. The response echoes the metadata recorded for the template and the resolved on-disk path.
The request body schema is open; no specific fields are documented by the server contract. Supply the template payload as a JSON object in the body.
" path " : " default/1/internal-sync.ts " ,
" tags " : [ " sync " , " internal " ],
" description " : " Internal sync script template " ,
" params " : [ " batchSize " , " dryRun " ],
" author " : " team-platform "
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Access denied " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
" error " : " Template already exists " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution CONFLICTResource conflict Operation conflicts with existing resource state Check resource state and retry
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X POST " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/create-custom " \
-H " Authorization: Bearer $HOODY_TOKEN " \
-H " Content-Type: application/json " \
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . createCustom ({});
Expands a template with the supplied variables and returns the generated code. Set saveFile to true and provide outputPath to persist the result to disk under /hoody/storage/hoody-exec/scripts/.
Name Type Required Description namestring Yes Name of the template to expand. variablesobject No Map of placeholder name to value used during expansion. outputPathstring No Destination path relative to /hoody/storage/hoody-exec/scripts, including the host/exec scope (for example, default/1/fetch-items.ts). Required when saveFile is true. saveFileboolean No When true, write the generated script to outputPath. Default false.
" template " : " api-fetch-items " ,
" code " : " export async function main() { \n const url = 'https://api.example.com/items'; \n const method = 'GET'; \n return await fetch(url, { method }); \n } \n " ,
" path " : " default/1/fetch-items.ts " ,
" url " : " https://api.example.com/items " ,
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Access denied " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
" error " : " Template not found " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution NOT_FOUNDResource not found The requested resource does not exist Verify the resource identifier
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X POST " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/generate " \
-H " Authorization: Bearer $HOODY_TOKEN " \
-H " Content-Type: application/json " \
"name": "api-fetch-items",
"url": "https://api.example.com/items",
"outputPath": "default/1/fetch-items.ts",
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . generate ({
url : ' https://api.example.com/items ' ,
outputPath : ' default/1/fetch-items.ts ' ,
Patches an existing custom template. Pass only the fields you want to change; the server merges metadata with the existing record and replaces code when supplied.
Name In Type Required Description namepath string Yes Name parameter
Name Type Required Description codestring No New source body for the template. Replaces the existing code on success. metadataobject No Partial metadata patch; merged with the existing record.
" tags " : [ " sync " , " internal " , " v2 " ],
" description " : " Internal sync script template (updated) " ,
" params " : [ " batchSize " , " dryRun " , " timeoutMs " ],
" author " : " team-platform "
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Template not found " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution NOT_FOUNDResource not found The requested resource does not exist Verify the resource identifier
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X PUT " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/update-custom/internal-sync " \
-H " Authorization: Bearer $HOODY_TOKEN " \
-H " Content-Type: application/json " \
"code": "export async function main() {\n console.log(\"updated\");\n}\n",
"tags": ["sync", "internal", "v2"]
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . updateCustom ( ' internal-sync ' , {
code : ' export async function main() { \n console.log("updated"); \n } \n ' ,
tags : [ ' sync ' , ' internal ' , ' v2 ' ]
Removes a user-supplied template from _hoody/templates/. Built-in templates cannot be deleted through this endpoint.
Name In Type Required Description namepath string Yes Name parameter
" error " : " Invalid parameter format " ,
" code " : " VALIDATION_ERROR " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
" error " : " Template not found " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
Error Code Title Description Resolution NOT_FOUNDResource not found The requested resource does not exist Verify the resource identifier
" error " : " Internal server error " ,
" timestamp " : " 2025-04-12T18:21:00.451Z "
curl -X DELETE " https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com/api/v1/exec/templates/delete-custom/internal-sync " \
-H " Authorization: Bearer $HOODY_TOKEN "
import { HoodyClient } from ' hoody-sdk ' ;
const client = new HoodyClient ({ baseURL : ' https://{projectId}-{containerId}-exec-1.{server}.containers.hoody.com ' , token : process . env . HOODY_TOKEN });
await client . exec . templates . deleteCustom ( ' internal-sync ' );