Use these endpoints to list built-in and custom script templates, preview a template with variable substitution, generate code from a template, and create, update, or delete custom templates stored under _hoody/templates/.
GET /api/v1/exec/templates/list
Returns the set of available script templates. By default, both built-in and user-supplied templates are included. Results can be filtered by metadata category.
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.
"tags" : [ " http " , " fetch " ],
"description" : " Fetch a JSON resource and print the body. " ,
"description" : " Print a timestamped log line. " ,
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Internal server error " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
const result = await client . exec . templates . list ( {
GET /api/v1/exec/templates/preview
Renders a template by name, returning both the original source and the code with the supplied variables substituted. Useful for inspecting what a generation call will produce before writing it to disk.
Name In Type Required Description namequery string Yes Name query parameter variablesquery string No Variables query parameter
"tags" : [ " http " , " fetch " ],
"description" : " Fetch a JSON resource and print the body. " ,
"code" : " const res = await fetch('https://api.example.com/items'); \n console.log(await res.json()); " ,
"originalCode" : " const res = await fetch('{{url}}'); \n console.log(await res.json()); " ,
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Resource not found " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
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-01-15T12:34:56.789Z "
const result = await client . exec . templates . preview ( {
variables: " { \" url \" : \" https://api.example.com/items \" } " ,
POST /api/v1/exec/templates/create-custom
Persists a new custom template under _hoody/templates/. The request body is required but its schema is intentionally open-ended; the server validates the structural fields internally.
This endpoint accepts a JSON payload. No specific fields are documented in the spec.
"path" : " /workspace/_hoody/templates/fetch-json.js " ,
"tags" : [ " http " , " fetch " ],
"description" : " Fetch a JSON resource and print the body. " ,
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Access denied " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
"error" : " Resource already exists " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution CONFLICTResource conflict Operation conflicts with existing resource state Check resource state and retry
"error" : " Internal server error " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
const result = await client . exec . templates . createCustom ( {
POST /api/v1/exec/templates/generate
Generates code from a named template, substituting the provided variables. Optionally writes the generated file to outputPath when saveFile is true.
Name Type Required Description namestring Yes Name variablesobject No Variables outputPathstring No Output Path saveFileboolean No Save File. Default false
"template" : " fetch-json " ,
"code" : " const res = await fetch('https://api.example.com/items'); \n console.log(await res.json()); " ,
"url" : " https://api.example.com/items "
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Access denied " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
"error" : " Resource not found " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
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-01-15T12:34:56.789Z "
const result = await client . exec . templates . generate ( {
variables: { url: " https://api.example.com/items " },
outputPath: " scripts/fetch.js " ,
PUT /api/v1/exec/templates/update-custom/:name
Patches an existing custom template. The :name path segment identifies the template. The request body can supply new code and/or a metadata patch that is merged with the existing metadata.
Name In Type Required Description namepath string Yes Name parameter
Name Type Required Description codestring No Code metadataobject No Metadata
"tags" : [ " http " , " fetch " , " retry " ],
"description" : " Fetch a JSON resource and print the body. " ,
"params" : [ " url " , " retries " ],
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Resource not found " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
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-01-15T12:34:56.789Z "
const result = await client . exec . templates . updateCustom ( {
code: " const res = await fetch('{{url}}'); \n console.log(await res.json()); " ,
metadata: { version: " 1.1.0 " , tags: [ " http " , " fetch " , " retry " ] },
DELETE /api/v1/exec/templates/delete-custom/:name
Removes a custom 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-01-15T12:34:56.789Z "
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Resource not found " ,
"timestamp" : " 2025-01-15T12:34:56.789Z "
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-01-15T12:34:56.789Z "
const result = await client . exec . templates . deleteCustom ( {