Topolo Docs Topolo Platform
Open workspace

Update email template

Change a template. Renaming changes it in place; any subject, preheader or blocks change appends a new immutable version and makes it current, so earlier versions stay readable. blocks is an ordered list of typed blocks: heading {text, level 1-3}, text {text with **bold**, _italic_ and [label](https://…) only}, image {src https, alt, width?, href?}, button {label, href https or mailto}, divider, spacer {height}, columns {2-3 columns of the other leaf blocks}, and exactly one footer {text?} as the LAST block, which always renders the unsubscribe and preference links plus the brand footer and postal address. Raw HTML is never accepted; every value is escaped. Merge tags {{contact.firstName|fallback}}, {{contact.lastName}} and {{contact.email}} are allowed in the subject, preheader and text.

Outcome

Change a template. Renaming changes it in place; any subject, preheader or blocks change appends a new immutable version and makes it current, so earlier versions stay readable. blocks is an ordered list of typed blocks: heading {text, level 1-3}, text {text with bold, italic and label only}, image {src https, alt, width?, href?}, button {label, href https or mailto}, divider, spacer {height}, columns {2-3 columns of the other leaf blocks}, and exactly one footer {text?} as the LAST block, which always renders the unsubscribe and preference links plus the brand footer and postal address. Raw HTML is never accepted; every value is escaped. Merge tags {{contact.firstName|fallback}}, {{contact.lastName}} and {{contact.email}} are allowed in the subject, preheader and text.

Before you start

  • Verify identity and pin the intended organization and environment before discovering the action.
  • Discover a granted Nurture workspace. The application permission is workspace:write; required workspace access is read_write. A permission alone does not supply a workspace grant.
  • Organization and workspace come from verified context. Select resourceType/resourceId separately from action input; body fields cannot grant a different organization or workspace. The first authorized product action can initialize an identity-only workspace mirror.
  • Obtain authorization for the documented effect or personal-data export before supplying CLI --confirm or MCP confirm:true.

Discover the target

topolo whoami --json
topolo actions get app_topolo_nurture.templates.update --detail --json
topolo resources topolo-nurture --json
topolo workspaces list topolo-nurture --json
topolo actions get app_topolo_nurture.templates.list --detail --json
  • id: templates record id in the selected workspace.

Request

PATCH /api/templates/{id}

Save action input as payload.json. The reviewed plan separates path identifiers, query fields and HTTP body. Set NURTURE_WORKSPACE_ID from granted resource discovery; it is separate from action input.

Inspect and test this action in the signed action console. A test response still requires the verification below.

Input fields

FieldRequiredTypeConstraints
idRequiredstringtemplates record id in the selected workspace. {"minLength":1,"maxLength":64}
nameOptionalstring{"minLength":1,"maxLength":120}
subjectOptionalstring{"minLength":1,"maxLength":200}
preheaderOptionalstring{"maxLength":200}
blocksOptionalarray{"minItems":1,"maxItems":100}

Exact input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "preheader": {
      "type": "string",
      "maxLength": 200
    },
    "blocks": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "heading"
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "level": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 1
                  },
                  {
                    "type": "number",
                    "const": 2
                  },
                  {
                    "type": "number",
                    "const": 3
                  }
                ]
              },
              "align": {
                "type": "string",
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "text",
              "level"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "text"
              },
              "text": {
                "type": "string",
                "maxLength": 10000
              },
              "align": {
                "type": "string",
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "text"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "image"
              },
              "src": {
                "type": "string",
                "maxLength": 2000,
                "pattern": "^https:\\/\\/[^\\s\"'<>]+$"
              },
              "alt": {
                "type": "string",
                "maxLength": 300
              },
              "width": {
                "type": "integer",
                "minimum": 16,
                "maximum": 600
              },
              "href": {
                "type": "string",
                "maxLength": 2000,
                "pattern": "^(https:\\/\\/|mailto:)[^\\s\"'<>]+$"
              }
            },
            "required": [
              "id",
              "kind",
              "src",
              "alt"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "button"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "href": {
                "type": "string",
                "maxLength": 2000,
                "pattern": "^(https:\\/\\/|mailto:)[^\\s\"'<>]+$"
              },
              "align": {
                "type": "string",
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "label",
              "href"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "divider"
              }
            },
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "spacer"
              },
              "height": {
                "type": "integer",
                "minimum": 4,
                "maximum": 96
              }
            },
            "required": [
              "id",
              "kind",
              "height"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "columns"
              },
              "columns": {
                "minItems": 2,
                "maxItems": 3,
                "type": "array",
                "items": {
                  "maxItems": 10,
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "heading"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "level": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 1
                              },
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 3
                              }
                            ]
                          },
                          "align": {
                            "type": "string",
                            "enum": [
                              "left",
                              "center",
                              "right"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "text",
                          "level"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "maxLength": 10000
                          },
                          "align": {
                            "type": "string",
                            "enum": [
                              "left",
                              "center",
                              "right"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "image"
                          },
                          "src": {
                            "type": "string",
                            "maxLength": 2000,
                            "pattern": "^https:\\/\\/[^\\s\"'<>]+$"
                          },
                          "alt": {
                            "type": "string",
                            "maxLength": 300
                          },
                          "width": {
                            "type": "integer",
                            "minimum": 16,
                            "maximum": 600
                          },
                          "href": {
                            "type": "string",
                            "maxLength": 2000,
                            "pattern": "^(https:\\/\\/|mailto:)[^\\s\"'<>]+$"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "src",
                          "alt"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "button"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "href": {
                            "type": "string",
                            "maxLength": 2000,
                            "pattern": "^(https:\\/\\/|mailto:)[^\\s\"'<>]+$"
                          },
                          "align": {
                            "type": "string",
                            "enum": [
                              "left",
                              "center",
                              "right"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "label",
                          "href"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "divider"
                          }
                        },
                        "required": [
                          "id",
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                          },
                          "kind": {
                            "type": "string",
                            "const": "spacer"
                          },
                          "height": {
                            "type": "integer",
                            "minimum": 4,
                            "maximum": 96
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "height"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            },
            "required": [
              "id",
              "kind",
              "columns"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
              },
              "kind": {
                "type": "string",
                "const": "footer"
              },
              "text": {
                "type": "string",
                "maxLength": 1000
              }
            },
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}

Effects

  • Renames the template, or appends a new version with the changed content and makes it current.

Interpret the response

The returned identifier path is $.template.id for template. Empty lists do not discover a target.

Call app_topolo_nurture.templates.get and confirm currentVersion and the changed fields.

Exact success schema:

{
  "type": "object",
  "required": [
    "template"
  ],
  "properties": {
    "template": {
      "type": "object",
      "required": [
        "id",
        "subject",
        "blocks",
        "version",
        "currentVersion"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "preheader": {
          "type": "string"
        },
        "blocks": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind"
            ]
          }
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "archived"
          ]
        },
        "version": {
          "type": "integer"
        },
        "currentVersion": {
          "type": "integer"
        },
        "createdAt": {
          "type": "string"
        },
        "updatedAt": {
          "type": "string"
        }
      }
    }
  }
}

Worked examples

Actual dispatcher and migration-created SQLite or Worker handlers; identity/workspace and external service dependencies are simulated. Fixture identifiers and timestamps are synthetic. These responses establish no live authorization, paid generation, credential provisioning or message delivery. Replace synthetic identifiers using credential-scoped discovery. A local success is not evidence of a deployed effect, configured provider or delivered message.

Successful request

Actual dispatcher and migration-created SQLite; verified identity/workspace and external CRM, Engage, Notify, Consent, Nexus, Brand, Generator, Voice and delivery dependencies are simulated. No live authorization, paid generation or external delivery is established.

Input · payload.json:

{
  "id": "tpl_13876e71ebd24014a08e2fe58ec53d65",
  "subject": "Version two"
}

CLI:

topolo actions validate app_topolo_nurture.templates.update --data @payload.json --json
topolo actions plan app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_nurture.templates.update",
    "input": {
      "id": "tpl_13876e71ebd24014a08e2fe58ec53d65",
      "subject": "Version two"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "template": {
    "id": "tpl_13876e71ebd24014a08e2fe58ec53d65",
    "name": "News",
    "status": "active",
    "version": 2,
    "currentVersion": 2,
    "subject": "Version two",
    "blocks": [
      {
        "id": "title",
        "kind": "heading",
        "text": "Hello {{contact.firstName|there}}",
        "level": 1
      },
      {
        "id": "footer",
        "kind": "footer"
      }
    ],
    "createdAt": "2026-10-04T00:32:34.979Z",
    "updatedAt": "2026-10-04T00:32:35.068Z"
  }
}

HTTP 200. Call app_topolo_nurture.templates.get and confirm currentVersion and the changed fields.

Another supported request

Actual dispatcher and migration-created SQLite; verified identity/workspace and external CRM, Engage, Notify, Consent, Nexus, Brand, Generator, Voice and delivery dependencies are simulated. No live authorization, paid generation or external delivery is established.

Input · payload.json:

{
  "id": "tpl_9db6eb17bbd046568862a03b577ed1b4",
  "subject": "Version two"
}

CLI:

topolo actions validate app_topolo_nurture.templates.update --data @payload.json --json
topolo actions plan app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_nurture.templates.update",
    "input": {
      "id": "tpl_9db6eb17bbd046568862a03b577ed1b4",
      "subject": "Version two"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "template": {
    "id": "tpl_9db6eb17bbd046568862a03b577ed1b4",
    "name": "News",
    "status": "active",
    "version": 2,
    "currentVersion": 2,
    "subject": "Version two",
    "blocks": [
      {
        "id": "title",
        "kind": "heading",
        "text": "Hello {{contact.firstName|there}}",
        "level": 1
      },
      {
        "id": "footer",
        "kind": "footer"
      }
    ],
    "createdAt": "2026-10-04T00:32:35.381Z",
    "updatedAt": "2026-10-04T00:32:35.383Z"
  }
}

HTTP 200. Call app_topolo_nurture.templates.get and confirm currentVersion and the changed fields.

Refused request · permission_denied

Actual dispatcher and migration-created SQLite; verified identity/workspace and external CRM, Engage, Notify, Consent, Nexus, Brand, Generator, Voice and delivery dependencies are simulated. No live authorization, paid generation or external delivery is established.

Input · payload.json:

{
  "id": "tpl_5e31c11f18e8412885cb4ad6dac80e10",
  "name": "x"
}

CLI:

topolo actions validate app_topolo_nurture.templates.update --data @payload.json --json
topolo actions plan app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 403:

{
  "error": {
    "code": "permission_denied",
    "message": "The credential lacks workspace:write."
  }
}

HTTP 403. Preserve the refusal details and do not claim success.

Refused request · template_archived

Actual dispatcher and migration-created SQLite; verified identity/workspace and external CRM, Engage, Notify, Consent, Nexus, Brand, Generator, Voice and delivery dependencies are simulated. No live authorization, paid generation or external delivery is established.

Input · payload.json:

{
  "id": "tpl_170548a3f8c04a9191b2ce2478b113af",
  "name": "x"
}

CLI:

topolo actions validate app_topolo_nurture.templates.update --data @payload.json --json
topolo actions plan app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 409:

{
  "error": {
    "code": "template_archived",
    "message": "An archived template cannot be edited."
  }
}

HTTP 409. Preserve the refusal details and do not claim success.

Refused request · not_found

Actual dispatcher and migration-created SQLite; verified identity/workspace and external CRM, Engage, Notify, Consent, Nexus, Brand, Generator, Voice and delivery dependencies are simulated. No live authorization, paid generation or external delivery is established.

Input · payload.json:

{
  "id": "tpl_missing",
  "name": "x"
}

CLI:

topolo actions validate app_topolo_nurture.templates.update --data @payload.json --json
topolo actions plan app_topolo_nurture.templates.update --resource-type workspace --resource-id "$NURTURE_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 404:

{
  "error": {
    "code": "not_found",
    "message": "Template was not found in this workspace."
  }
}

HTTP 404. Preserve the refusal details and do not claim success.

Verify the result

  • Call app_topolo_nurture.templates.get and confirm currentVersion and the changed fields.

Errors and recovery

  • organization_required (HTTP 403): Select an organization available to the verified caller before choosing a Nurture workspace.
  • permission_denied (HTTP 403): Grant the credential the required Nurture workspace permission.
  • workspace_required (HTTP 409): Create a Nurture workspace, or pass the workspace resource context.
  • invalid_input (HTTP 422): Correct the fields named in error.details using inputSchema, then retry.
  • not_found (HTTP 404): List templates to find a valid id in this workspace.
  • invalid_template (HTTP 422): Fix each problem in error.details.problems; app_topolo_nurture.templates.validate lists them without saving.
  • template_archived (HTTP 409): Duplicate the template with app_topolo_nurture.templates.duplicate and edit the copy.

Auth or gateway failures may precede this handler. Preserve the exact response shape, error string/code, request id and credential context; no synthetic fixture establishes live credential access.

Recovery boundary

Read the previous version with app_topolo_nurture.templates.get {id, version} and send its subject, preheader and blocks back through update.

  • Get email template: Read one email template with its subject, preheader and blocks. Without version it returns the current version; with version it returns that immutable historical version.
  • Preview email template: Render a saved template version (templateId, version?) or an unsaved draft to email-safe HTML (tables, inline styles, dark-mode and mobile rules) plus the auto-generated plain-text alternative, for an optional sample contact. Brand name, email logo, light and dark accent colours, footer, legal entity, postal address and unsubscribe wording come from the workspace TopoloBrand kit when one is bound and readable, else the workspace template brand settings, else neutral defaults; Brand being unavailable never fails a preview. Unsubscribe and preference links are inert placeholders (#unsubscribe, #preferences); a real send substitutes signed recipient links. No side effects: nothing is saved or sent.
  • Update email template: Change a template. Renaming changes it in place; any subject, preheader or blocks change appends a new immutable version and makes it current, so earlier versions stay readable. blocks is an ordered list of typed blocks: heading {text, level 1-3}, text {text with bold, italic and label only}, image {src https, alt, width?, href?}, button {label, href https or mailto}, divider, spacer {height}, columns {2-3 columns of the other leaf blocks}, and exactly one footer {text?} as the LAST block, which always renders the unsubscribe and preference links plus the brand footer and postal address. Raw HTML is never accepted; every value is escaped. Merge tags {{contact.firstName|fallback}}, {{contact.lastName}} and {{contact.email}} are allowed in the subject, preheader and text.

Evidence

Actual dispatcher and migration-created SQLite or Worker handlers; identity/workspace and external service dependencies are simulated. Fixture identifiers and timestamps are synthetic. These responses establish no live authorization, paid generation, credential provisioning or message delivery. Test scenario and capture digests are retained with each fixture.