v1

latestOpenAPI 3.0.22026-07-12121135.6 KB
Templates

Replace variables in templates (V2)

Replace variables in handlebars templates with raw value preservation

V2 returns parsed outputs that preserve the original data types (arrays, objects, strings) instead of stringifying always. Variables with strings mixed with other variables will be returned in the stringified format. Alongside the parsed outputs for every single variable.

Takes in an array of input templates and outputs an object mapping each input and variable to their rendered values with type preservation.

post/v2/template:replace

Request body

inputsstring[]

Example request

{
  "inputs": [
    "Hello, {{contact.first_name}}!\n"
  ],
  "parameters": {
    "main_entity_id": "63753437-c9e2-4e83-82bb-b1c666514561",
    "brand_id": 123451,
    "user_id": "50001",
    "user_org_id": "729224",
    "custom_variables": [
      {
        "variable": "{{craftsmen.invitation_link}}",
        "value": "https://partner.epilot.cloud/activate-account?user_name=htny.pct%2Btet%40gmail.com&confirmation_code=EdXPRW19"
      }
    ],
    "variables_version": "2"
  }
}

Response

ok

outputsobject

Dictionary mapping input templates and variable names to their resolved output values. Values preserve their original types (string, array, object) instead of being stringified.

Keys include:

  • Original input templates (e.g., "Hello {{name}}")
  • Individual variables found in templates (e.g., "{{name}}", "{{product_images[*].public_url}}")

Example response

{
  "outputs": {
    "Hello {{first_name}}": "Hello John",
    "{{first_name}}": "John",
    "{{product_images[*].public_url}}": [
      "http://myimage.server.com/img1.png",
      "http://myimage.server.com/img2.png"
    ]
  }
}