---
title: "convertToBuilder"
method: POST
path: "/v1/email-template/templates/{id}:convertToBuilder"
tags: ["Email templates"]
---

# convertToBuilder

`POST /v1/email-template/templates/{id}:convertToBuilder`

Converts a legacy HTML email template into the email-builder block format.
Stores the new `json_template` (stringified block graph), re-renders `body`
from the resulting blocks, and stashes the original HTML at `backup.body`.
Returns 409 if the template is already converted unless `force=true`.

## Path parameters

- `id` string, required

## Request body

- object
  - `dryRun` boolean — When true, return the converted output without saving.
  - `force` boolean — When true, overwrite an existing json_template.
  - `as_copy` boolean — When true, leave the source template untouched and save the converted result as a NEW template (linked via original_template_id). The response is the new entity.
  - `name` string — Optional name for the as_copy result. The UI sends a localized copy name (e.g. "Copy of <name> (Visual)") so the new template is named like the list-view "Duplicate" action. Ignored unless as_copy is true.

## Response `200`

Success

- EmailTemplateEntity
  - `_id` string, required — Entity ID
  - `_title` string, required — Entity title
  - `_org` string, required — Ivy Organization ID the entity belongs to
  - `_schema` string, required — URL-friendly identifier for the entity schema
  - `_tags` string[] — Entity tags
  - `_created_at` string, date-time, required — Created date
  - `_updated_at` string, date-time, required — Updated date
  - `_purpose` string[] — Entity Purposes
  - `_manifest` string[] — Manifest ID used to create/update the entity
  - `name` string, required — name
  - `brand_id` number, nullable — Brand ID. Equal 0 if available for All brands
  - `from` From
    - `name` string
    - `email` string, required
  - `to` To[] — To
    - `name` string
    - `email` string, required
  - `cc` To[] — Cc
    - `name` string
    - `email` string, required
  - `bcc` To[] — Bcc
    - `name` string
    - `email` string, required
  - `subject` string — Subject
  - `body` string — Body
  - `attachments` Attachment[], nullable — Email template attachments
    - `cid` string — Attachment ID
    - `filename` string, required — File name
    - `size` number, required — File size in bytes
    - `content_type` string, required — Content type
    - `url` string — URL to download the attachment.
    - `bucket` string, required — S3 bucket where file is stored
    - `object_key` string, required — S3 object apiKey
    - `inline` boolean — If true then this attachment should not be offered for download (at least not in the main attachments list).\ The usecase is CID embedded image (aka inline image).
    - `send_as_link` boolean — If true then this attachment is sent via link. The link is already inserted to email body by API caller. In this case, service doesn't process this attachment.
    - `type` string — File type such as Document template, Document,... Use for replace variables on document template
    - `copy_to_message` boolean — If true then this attachment is copied to the message and replaces corresponding one
  - `file` object
    - `$relation` object[] — Entity tags
  - `created_by` string — Created by
  - `updated_by` string — Updated by
  - `json_template` string — This field is used to store JSON templates. If this field is populated, then the Body html is derived from the JSON.
  - `backup` object — Snapshot of the legacy template body, taken when migrating to the email-builder format.
    - `body` string — Original HTML body before conversion to email-builder blocks.
    - `backed_up_at` string — ISO 8601 timestamp when the backup was created.
  - `converted_to_new_editor` boolean — True after the template has been converted from legacy HTML to the new email-builder format. Used by the UI to expose the "Revert to legacy HTML" action.
  - `system_template` boolean — If template is created by system (Double Opt-in, CMD invitation,...) then true, and some attributes can not be edited such as Name, To,... Remember to add default content of template to system_template enum for revert to original feature
  - `original_template_id` string, nullable — Set on a duplicated template to point at its source template id. Cleared after automations have been migrated via `migrateAutomationsForTemplate`.

## Other responses

- `400` — Template body is empty
- `403` — Forbidden
- `404` — Not found
- `409` — Template already converted; pass force=true to overwrite

---

[API](https://skmtc.dev/epilot/apis/email-template-api.md) · [All operations](https://skmtc.dev/epilot/apis/email-template-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/epilot/email-template-api/revisions/0c6165eaceb0/schema)
