List, preview, generate, and manage custom script templates. The templates API lets you discover available code generation templates, render them with variables, create user-supplied templates from _hoody/templates/, and update or delete those custom entries.
GET /api/v1/exec/templates/list
Returns all available script templates, including built-in and user-supplied entries. Use the category filter to narrow the result set to a single metadata category such as api or utility.
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 " ]
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Internal server error " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
const { count , templates } = await client . exec . templates . list ( {
curl -X GET " https://api.hoody.com/api/v1/exec/templates/list?category=api&includeBuiltin=true&includeCustom=true " \
-H " Authorization: Bearer <token> "
GET /api/v1/exec/templates/preview
Render a template with the supplied variables and return the substituted code alongside the original source. Useful for inspecting what a generation will produce before committing to writing a file.
Name In Type Required Description namequery string Yes Name query parameter variablesquery string No Variables query parameter
"tags" : [ " http " , " fetch " ]
"code" : " const url = 'https://api.example.com'; \n fetch(url).then(r => r.json()); " ,
"originalCode" : " const url = '{{baseUrl}}'; \n fetch(url).then(r => r.json()); " ,
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Template not found " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
"name" : " missing-template "
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-15T10:30:00.000Z " ,
const { template } = await client . exec . templates . preview ( {
variables: " baseUrl=https://api.example.com " ,
curl -X GET " https://api.hoody.com/api/v1/exec/templates/preview?name=api-fetch&variables=baseUrl%3Dhttps%3A%2F%2Fapi.example.com " \
-H " Authorization: Bearer <token> "
POST /api/v1/exec/templates/create-custom
Persist a new user-supplied template under _hoody/templates/. The endpoint accepts a request payload describing the template code and its metadata.
This endpoint accepts a JSON request body. No specific body fields are defined in the schema.
"name" : " my-custom-fetch " ,
"path" : " _hoody/templates/my-custom-fetch.js " ,
"name" : " my-custom-fetch " ,
"tags" : [ " http " , " custom " ],
"description" : " Fetch helper for internal APIs " ,
"params" : [ " baseUrl " , " method " ],
"author" : " dev@hoody.com "
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Access denied " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
"error" : " Template already exists " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
"name" : " my-custom-fetch "
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-15T10:30:00.000Z " ,
const result = await client . exec . templates . createCustom ( {
curl -X POST " https://api.hoody.com/api/v1/exec/templates/create-custom " \
-H " Authorization: Bearer <token> " \
-H " Content-Type: application/json " \
POST /api/v1/exec/templates/generate
Render a template with variables and optionally write the result to disk. Returns the generated code, the file path if saved, and the variable map that was applied.
Field Type Required Description namestring Yes Name of the template to generate. variablesobject No Map of template variables used during substitution. outputPathstring No Destination path where generated code is written when saveFile is true. saveFileboolean No When true, writes the rendered code to outputPath. Default false.
"code" : " const url = 'https://api.example.com'; \n fetch(url).then(r => r.json()); " ,
"path" : " _hoody/generated/api-fetch.js " ,
"baseUrl" : " https://api.example.com "
"error" : " Missing required field: name " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Access denied " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution FORBIDDENAccess denied Insufficient permissions for this operation Contact administrator for access
"error" : " Template not found " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
"name" : " missing-template "
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-15T10:30:00.000Z " ,
const result = await client . exec . templates . generate ( {
variables: { baseUrl: " https://api.example.com " },
outputPath: " _hoody/generated/api-fetch.js " ,
curl -X POST " https://api.hoody.com/api/v1/exec/templates/generate " \
-H " Authorization: Bearer <token> " \
-H " Content-Type: application/json " \
"variables": { "baseUrl": "https://api.example.com" },
"outputPath": "_hoody/generated/api-fetch.js",
PUT /api/v1/exec/templates/update-custom/:name
Patch the source code and/or metadata of an existing custom template. The supplied metadata object is merged with existing metadata rather than replacing it.
Name In Type Required Description namepath string Yes Name of the custom template to update.
Field Type Required Description codestring No Replacement source code for the template. metadataobject No Metadata fields to merge into the existing template metadata.
"name" : " my-custom-fetch " ,
"name" : " my-custom-fetch " ,
"tags" : [ " http " , " custom " , " internal " ],
"description" : " Fetch helper for internal APIs (updated) " ,
"params" : [ " baseUrl " , " method " ],
"author" : " dev@hoody.com "
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Template not found " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
"name" : " missing-template "
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-15T10:30:00.000Z " ,
const result = await client . exec . templates . updateCustom ( {
code: " fetch('{{baseUrl}}', { method: '{{method}}' }).then(r => r.json()); " ,
tags: [ " http " , " custom " , " internal " ] ,
params: [ " baseUrl " , " method " ] ,
curl -X PUT " https://api.hoody.com/api/v1/exec/templates/update-custom/my-custom-fetch " \
-H " Authorization: Bearer <token> " \
-H " Content-Type: application/json " \
"code": "fetch(\"{{baseUrl}}\", { method: \"{{method}}\" }).then(r => r.json());",
"tags": ["http", "custom", "internal"],
"params": ["baseUrl", "method"]
DELETE /api/v1/exec/templates/delete-custom/:name
Remove a user-supplied template from _hoody/templates/. Built-in templates cannot be deleted.
Name In Type Required Description namepath string Yes Name of the custom template to delete.
"name" : " my-custom-fetch "
"error" : " Invalid parameter format " ,
"code" : " VALIDATION_ERROR " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
Error Code Title Description Resolution VALIDATION_ERRORInvalid input Request parameters failed validation Check parameter format and requirements
"error" : " Template not found " ,
"timestamp" : " 2025-01-15T10:30:00.000Z " ,
"name" : " missing-template "
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-15T10:30:00.000Z " ,
const result = await client . exec . templates . deleteCustom ( {
curl -X DELETE " https://api.hoody.com/api/v1/exec/templates/delete-custom/my-custom-fetch " \
-H " Authorization: Bearer <token> "