Creates a new email template with either HTML or JSON content. Provide html for raw HTML templates or json for visual editor (Topol) templates — these fields are mutually exclusive.The template is automatically assigned a URL-friendly slug based on its name. You can optionally assign it to a specific project and folder using project_id and folder_id. If omitted, the template is added to your team’s default project.
Choosing the mode
purpose decides which of Lettr’s two modes the template belongs to:
transactional (default) — receipts, password resets, alerts; the templates you send single emails with
campaign — marketing content, and the only kind a campaign can pick
purpose cannot be changed afterwards. It is not accepted by Update Template — sending it there returns 200 and leaves the mode untouched. A newsletter created without purpose becomes a transactional template that campaigns cannot use, and the only remedy is the Copy to Marketing action in the app.If the template is going to an audience rather than to one person, pass purpose: "campaign" now.
Folders are mode-scoped, so folder_id must name a folder of the same mode as purpose; a folder of the other mode returns 422. Leave folder_id out and the template goes to the main folder of its mode, so a campaign template appears in the marketing module and the campaign picker straight away. Use List Folders to find a folder — it is the only endpoint that returns folder IDs, and it reports each folder’s mode.
Validation
json must be a Topol editor design. JSON that isn’t one is rejected with 422 instead of being saved as a template that breaks when opened in the editor.
Preparation
Templates created from json are rendered by a background job, so the response comes back with preparation_status: "pending" and no HTML yet. Rendering in the background means large imports don’t time out. It normally settles within seconds, and ends as ready or failed — poll Get Template until preparation_status is ready before sending.Templates created from raw html are ready immediately.
Authorizations
Authorization
string
header
required
API key for authentication
Body
application/json
Request to create a new email template. Provide either html for custom HTML templates or json for Topol visual editor templates.
name
string
required
Name of the template
Maximum string length: 255
Example:
"Welcome Email"
project_id
integer
Project ID to create the template in. If not provided, uses the team's default project.
Required range: x >= 1
Example:
5
folder_id
integer
Folder ID to create the template in. Must belong to the same module as purpose. If not provided, the first folder of that module is used, and one is created when the project has none.
Required range: x >= 1
Example:
10
html
string
HTML content for custom HTML templates. Required if json is not provided. Mutually exclusive with json.
Module the template belongs to. transactional templates are the ones you send single emails with; campaign templates are the ones the campaign builder can pick. Defaults to transactional.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/schema.json","name":"Lettr","colors":{"primary":"#EC104B","light":"#F04070","dark":"#D00E43"},"logo":{"light":"https://mintcdn.com/lettr/w6cQMnBCGTvjJ4__/logo/light.svg?fit=max\u0026auto=format\u0026n=w6cQMnBCGTvjJ4__\u0026q=85\u0026s=2cad5a94a80e61999cf9feaeac06e9c6","dark":"https://mintcdn.com/lettr/w6cQMnBCGTvjJ4__/logo/dark.svg?fit=max\u0026auto=format\u0026n=w6cQMnBCGTvjJ4__\u0026q=85\u0026s=2d94948c6f2c26d1375758ec890ccd4b","href":"/introduction"},"favicon":"https://mintcdn.com/lettr/MeT4pWpyRN-RhvgL/favicon.svg?fit=max\u0026auto=format\u0026n=MeT4pWpyRN-RhvgL\u0026q=85\u0026s=800c7fba1be1e2324447ed3b67ef0a48","api":{},"appearance":{"default":"dark"},"navbar":{"links":[{"href":"https://status.lettr.com/","label":"Status"},{"href":"https://lettr.com/support","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.lettr.com"}},"footer":{"socials":{"x":"https://x.com/lettr_com","linkedin":"https://www.linkedin.com/company/lettr-com","github":"https://github.com/lettr-com"}},"fonts":{"heading":{"family":"Manrope","weight":400},"body":{"family":"Manrope"}},"integrations":{"ga4":{"measurementId":"G-GMH8JTRY9Q"},"posthog":{"apiKey":"phc_67BYz5Uv0uoiydQyaN3OyeK9OPx6LjmFDFvF0mNaTy9","apiHost":"https://eu.i.posthog.com","sessionRecording":true}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lettr","hasAudioNarration":false,"actualSubdomain":"lettr","customDomains":["docs.lettr.com"],"gitSource":{"type":"github","owner":"lettr-com","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"edits":true,"thumbs":true,"issues":true},"entitlements":{},"buildId":"6afdbd922d5b5666c136f0d2","clientVersion":"0.0.4205","searchFilterCounts":[{"language":"default","tag":"Documentation","count":186},{"language":"default","tag":"Learn","count":110},{"language":"default","tag":"Knowledge Base","count":87},{"language":"default","tag":"API Reference","count":72},{"language":"default","tag":"Quickstart","count":68},{"language":"default","tag":"DNS Guides","count":19},{"language":"default","tag":"Templates","count":18},{"language":"default","tag":"Domains","count":16},{"language":"default","tag":"Email Fundamentals","count":15},{"language":"default","tag":"Troubleshooting","count":15}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":":root{--rounded: 0px;--rounded-sm: 0px;--rounded-md: 0px;--rounded-lg: 0px;--rounded-xl: 0px;--rounded-2xl: 0px;--rounded-3xl: 0px;--rounded-search: 0px;--c15t-radius-sm: 0px;--c15t-radius-md: 0px;--c15t-radius-lg: 0px;--cdt-radius: 0px;--accordion-radius: 0px;--button-border-radius: 0px;--consent-banner-border-radius: 0px;--consent-dialog-card-radius: 0px;--consent-widget-radius: 0px;--consent-widget-accordion-radius: 0px;--frame-placeholder-border-radius: 0px;--scrollbar-track-radius: 0px;--scrollbar-thumb-radius: 0px;--scrollbar-corner-radius: 0px}*,*::before,*::after,::backdrop,::file-selector-button{border-radius:0!important}[class~=\"rounded-full\"],[class~=\"rounded-full!\"]{border-radius:9999px!important}.prose :where(ul>li)::before,.prose-sm :where(ul>li)::before,.latex-style ul>li::before{border-radius:50%!important}.sdk-list{--sdk-fg: rgb(24 14 19);--sdk-muted: rgb(24 14 19 / 0.55);--sdk-line: rgb(60 20 35 / 0.1);--sdk-hover: rgb(236 16 75 / 0.035);--sdk-code-bg: rgb(60 20 35 / 0.035);--sdk-code-line: rgb(60 20 35 / 0.12);--sdk-accent: #d00e43;--sdk-ease: cubic-bezier(0.22, 1, 0.36, 1);margin:1.25rem 0 2.5rem;border-top:1px solid var(--sdk-line)}.dark .sdk-list{--sdk-fg: rgb(250 242 245);--sdk-muted: rgb(250 242 245 / 0.5);--sdk-line: rgb(255 225 235 / 0.09);--sdk-hover: rgb(240 64 112 / 0.05);--sdk-code-bg: rgb(255 225 235 / 0.035);--sdk-code-line: rgb(255 225 235 / 0.1);--sdk-accent: #f04070}.sdk-row{position:relative;display:grid;grid-template-columns:1.25rem 8.75rem minmax(0, 1fr) 1rem;align-items:center;column-gap:1rem;padding:0.875rem 0.75rem;border-bottom:1px solid var(--sdk-line);transition:background-color 180ms var(--sdk-ease)}.sdk-row:hover{background-color:var(--sdk-hover)}.sdk-row:has(.sdk-row__name:focus-visible){outline:2px solid var(--sdk-accent);outline-offset:-2px}.sdk-row__logo{display:flex;align-items:center;justify-content:center;color:var(--sdk-muted);transition:color 180ms var(--sdk-ease)}.sdk-row__logo svg,.sdk-row__logo span{background-color:currentColor!important}.sdk-row:hover .sdk-row__logo{color:var(--sdk-fg)}.sdk-row__name{position:static!important;z-index:auto!important;font-size:0.9375rem;font-weight:600;letter-spacing:-0.005em;color:var(--sdk-fg);text-decoration:none;white-space:nowrap}.sdk-row__name:focus-visible{outline:none}.sdk-row__name::after{content:\"\";position:absolute;inset:0}.sdk-row__install{position:relative;z-index:1;justify-self:start;display:inline-flex;align-items:center;gap:0.625rem;max-width:100%;min-width:0;padding:0.3125rem 0.5rem 0.3125rem 0.625rem;border:1px solid var(--sdk-code-line);background:var(--sdk-code-bg);color:var(--sdk-fg);cursor:pointer;transition:border-color 180ms var(--sdk-ease)}.sdk-row__install:hover{border-color:var(--sdk-accent)}.sdk-row__install:focus-visible{outline:2px solid var(--sdk-accent);outline-offset:2px}.sdk-row__install code{padding:0!important;border:0!important;background:none!important;color:inherit!important;overflow:hidden;font-size:0.8125rem;line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.sdk-row__copy{display:flex;flex-shrink:0;color:var(--sdk-muted);transition:color 180ms var(--sdk-ease)}.sdk-row__install:hover .sdk-row__copy,.sdk-row__copy[data-copied=\"true\"]{color:var(--sdk-accent)}.sdk-row__arrow{color:var(--sdk-muted);transition:transform 220ms var(--sdk-ease),\n color 180ms var(--sdk-ease)}.sdk-row:hover .sdk-row__arrow{color:var(--sdk-accent);transform:translate(2px, -2px)}.sdk-row__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.sdk-list--inline{margin:0 0 1.25rem}:has(+.sdk-list--inline){margin-bottom:0.625rem!important}@media (max-width: 640px){.sdk-row{grid-template-columns:1.25rem minmax(0, 1fr) 1rem;row-gap:0.625rem;padding:0.875rem 0.5rem}.sdk-row__install{grid-row:2;grid-column:2 / 4;justify-self:stretch;justify-content:space-between;min-height:2.75rem;padding-block:0.5rem;text-align:left}.sdk-row__install code{white-space:normal;overflow-wrap:anywhere}}@media (prefers-reduced-motion: reduce){.sdk-row,.sdk-row__logo,.sdk-row__install,.sdk-row__copy,.sdk-row__arrow{transition:none}.sdk-row:hover .sdk-row__arrow{transform:none}}.whitespace-pre-wrap>pre.shiki,.whitespace-pre-wrap>pre.shiki code{white-space:pre-wrap!important;overflow-wrap:anywhere}[data-component-part=\"card-icon\"]:has(>img[src*=\"/images/integrations/\"]){display:flex;align-items:center;width:auto}[data-component-part=\"card-icon\"]>img[src*=\"/images/integrations/\"]{width:auto;height:1.25rem;object-position:-9999px 0;background-color:rgb(var(--primary));mask:var(--partner-logo) center / contain no-repeat}.dark [data-component-part=\"card-icon\"]>img[src*=\"/images/integrations/\"]{background-color:rgb(var(--primary-light))}[data-component-part=\"card-icon\"]>img[src*=\"/integrations/apiant.svg\"]{--partner-logo: url(\"/images/integrations/apiant.svg\")}[data-component-part=\"card-icon\"]>img[src*=\"/integrations/elaichi.svg\"]{--partner-logo: url(\"/images/integrations/elaichi.svg\")}[data-component-part=\"card-icon\"]>img[src*=\"/integrations/flowrunner.svg\"]{--partner-logo: url(\"/images/integrations/flowrunner.svg\")}[data-component-part=\"card-icon\"]>img[src*=\"/integrations/truto.svg\"]{--partner-logo: url(\"/images/integrations/truto.svg\")}[data-component-part=\"card-icon\"]>img[src*=\"/integrations/unified.svg\"]{--partner-logo: url(\"/images/integrations/unified.svg\")}"}],"page":{"pagePath":"api-reference/templates/create-template","slug":"/api-reference/templates/create-template","pageMetadata":{"title":"Create Template","openapi":"POST /templates","description":"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.","href":"/api-reference/templates/create-template"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Warning}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Creates a new email template with either HTML or JSON content. Provide `,_jsx(_components.code,{children:`html`}),` for raw HTML templates or `,_jsx(_components.code,{children:`json`}),` for visual editor (Topol) templates — these fields are mutually exclusive.`]}),`\n`,_jsxs(_components.p,{children:[`The template is automatically assigned a URL-friendly slug based on its name. You can optionally assign it to a specific project and folder using `,_jsx(_components.code,{children:`project_id`}),` and `,_jsx(_components.code,{children:`folder_id`}),`. If omitted, the template is added to your team’s default project.`]}),`\n`,_jsx(Heading,{level:`2`,id:`choosing-the-mode`,children:`Choosing the mode`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`purpose`}),` decides which of Lettr’s two modes the template belongs to:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`transactional`})}),` (default) — receipts, password resets, alerts; the templates you send single emails with`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`campaign`})}),` — marketing content, and the only kind a `,_jsx(_components.a,{href:`/learn/campaigns/introduction`,children:`campaign`}),` can pick`]}),`\n`]}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`purpose`}),` cannot be changed afterwards.`]}),` It is not accepted by `,_jsx(_components.a,{href:`/api-reference/templates/update-template`,children:`Update Template`}),` — sending it there returns `,_jsx(_components.code,{children:`200`}),` and leaves the mode untouched. A newsletter created without `,_jsx(_components.code,{children:`purpose`}),` becomes a transactional template that campaigns cannot use, and the only remedy is the `,_jsx(_components.strong,{children:`Copy to Marketing`}),` action in the app.`]}),_jsxs(_components.p,{children:[`If the template is going to an audience rather than to one person, pass `,_jsx(_components.code,{children:`purpose: \"campaign\"`}),` now.`]})]}),`\n`,_jsxs(_components.p,{children:[`Folders are mode-scoped, so `,_jsx(_components.code,{children:`folder_id`}),` must name a folder of the same mode as `,_jsx(_components.code,{children:`purpose`}),`; a folder of the other mode returns `,_jsx(_components.code,{children:`422`}),`. Leave `,_jsx(_components.code,{children:`folder_id`}),` out and the template goes to the main folder of its mode, so a `,_jsx(_components.code,{children:`campaign`}),` template appears in the marketing module and the campaign picker straight away. Use `,_jsx(_components.a,{href:`/api-reference/templates/list-folders`,children:`List Folders`}),` to find a folder — it is the only endpoint that returns folder IDs, and it reports each folder’s mode.`]}),`\n`,_jsx(Heading,{level:`2`,id:`validation`,children:`Validation`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`json`}),` must be a Topol editor design. JSON that isn’t one is rejected with `,_jsx(_components.code,{children:`422`}),` instead of being saved as a template that breaks when opened in the editor.`]}),`\n`,_jsx(Heading,{level:`2`,id:`preparation`,children:`Preparation`}),`\n`,_jsxs(_components.p,{children:[`Templates created from `,_jsx(_components.code,{children:`json`}),` are rendered by a background job, so the response comes back with `,_jsx(_components.code,{children:`preparation_status: \"pending\"`}),` and no HTML yet. Rendering in the background means large imports don’t time out. It normally settles within seconds, and ends as `,_jsx(_components.code,{children:`ready`}),` or `,_jsx(_components.code,{children:`failed`}),` — poll `,_jsx(_components.a,{href:`/api-reference/templates/get-template`,children:`Get Template`}),` until `,_jsx(_components.code,{children:`preparation_status`}),` is `,_jsx(_components.code,{children:`ready`}),` before sending.`]}),`\n`,_jsxs(_components.p,{children:[`Templates created from raw `,_jsx(_components.code,{children:`html`}),` are `,_jsx(_components.code,{children:`ready`}),` immediately.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Create Template","openapi":"POST /templates","description":"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.","href":"/api-reference/templates/create-template"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Choosing the mode","slug":"choosing-the-mode","depth":2,"children":[]},{"title":"Validation","slug":"validation","depth":2,"children":[]},{"title":"Preparation","slug":"preparation","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"createTemplate","summary":"Create Template","description":"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.","tags":["Templates"],"security":["9a3f359c-ecd5-4491-8cf3-5ab8c4329186"],"requestBody":"0f5d71a8-d734-4196-8279-c0fb930a48d7","responses":{"201":"9675b0ad-f3d4-442b-aa2a-e716c29cb123","401":"cb9280f5-867c-4dff-bb26-02e93a419af2","404":"68410f7b-5eed-45ce-96f2-63d5755822ec","422":"5d46361e-3bbe-41af-a949-80955bd4f43b","500":"8b15991e-77af-4c3b-a457-26e4aebd3a9d","503":"085ce7ab-f8a1-48d9-ab1e-5f7dabac82cc"},"method":"post","type":"path","servers":["3a9a6297-5f46-49ab-955a-fb22c45ca41c"],"path":"/templates","baseUrlOptions":["https://app.lettr.com/api"],"title":"Create Template","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Request to create a new email template. Provide either `html` for custom HTML templates or `json` for Topol visual editor templates.","required":["name"],"properties":{"name":{"type":"string","maxLength":255,"description":"Name of the template","example":"Welcome Email","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"project_id":{"type":"integer","minimum":1,"description":"Project ID to create the template in. If not provided, uses the team's default project.","example":5,"uniqueKey":"project_id","typeLabel":"integer"},"folder_id":{"type":"integer","minimum":1,"description":"Folder ID to create the template in. Must belong to the same module as `purpose`. If not provided, the first folder of that module is used, and one is created when the project has none.","example":10,"uniqueKey":"folder_id","typeLabel":"integer"},"html":{"type":"string","description":"HTML content for custom HTML templates. Required if `json` is not provided. Mutually exclusive with `json`.","example":"\u003chtml>\u003cbody>\u003cp>Hello {{NAME}}!\u003c/p>\u003c/body>\u003c/html>","uniqueKey":"html","typeLabel":"string"},"json":{"type":"string","description":"JSON content for Topol visual editor templates. Required if `html` is not provided. Mutually exclusive with `html`.","example":"{\"tagName\":\"mj-container\",\"children\":[{\"tagName\":\"mj-text\",\"content\":\"Hello {{FIRST_NAME}}!\"}]}","uniqueKey":"json","typeLabel":"string"},"purpose":{"type":"string","enum":["transactional","campaign"],"default":"transactional","description":"Module the template belongs to. `transactional` templates are the ones you send single emails with; `campaign` templates are the ones the campaign builder can pick. Defaults to `transactional`.","example":"campaign","uniqueKey":"purpose","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"examples":{"with_json":{"title":"with_json","summary":"Create with Topol JSON","value":{"name":"Welcome Email","json":"{\"tagName\":\"mj-container\",\"children\":[{\"tagName\":\"mj-text\",\"content\":\"Hello {{FIRST_NAME}}!\"}]}"}},"with_html":{"title":"with_html","summary":"Create with custom HTML","value":{"name":"Newsletter","html":"\u003chtml>\u003cbody>\u003cp>Hello {{NAME}}, your order {{ORDER_ID}} is ready!\u003c/p>\u003c/body>\u003c/html>"}},"with_project_and_folder":{"title":"with_project_and_folder","summary":"Create in specific project and folder","value":{"name":"Invoice Email","project_id":5,"folder_id":10,"html":"\u003chtml>\u003cbody>\u003cp>Invoice for {{CUSTOMER_NAME}}\u003c/p>\u003c/body>\u003c/html>"}},"marketing_template":{"title":"marketing_template","summary":"Create a marketing template for campaigns","value":{"name":"October Newsletter","purpose":"campaign","html":"\u003chtml>\u003cbody>\u003cp>Hi {{FIRST_NAME}}, here is what shipped this month.\u003c/p>\u003c/body>\u003c/html>"}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"9675b0ad-f3d4-442b-aa2a-e716c29cb123":{"description":"Template created successfully","content":{"application/json":{"schema":{"type":"object","description":"Response after successfully creating a template","required":["message","data"],"properties":{"message":{"type":"string","description":"Human-readable response message","example":"Template created successfully.","isRequired":true,"uniqueKey":"message","typeLabel":"string"},"data":{"type":"object","description":"View of a newly created template","required":["id","name","slug","project_id","folder_id","purpose","preparation_status","active_version","merge_tags","created_at"],"properties":{"id":{"type":"integer","description":"Unique identifier for the template","example":123,"isRequired":true,"uniqueKey":"data.id","typeLabel":"integer"},"name":{"type":"string","description":"Name of the template","example":"Welcome Email","isRequired":true,"uniqueKey":"data.name","typeLabel":"string"},"slug":{"type":"string","description":"URL-friendly identifier for the template","example":"welcome-email","isRequired":true,"uniqueKey":"data.slug","typeLabel":"string"},"project_id":{"type":"integer","description":"ID of the project containing this template","example":5,"isRequired":true,"uniqueKey":"data.project_id","typeLabel":"integer"},"folder_id":{"type":"integer","description":"ID of the folder containing this template","example":10,"isRequired":true,"uniqueKey":"data.folder_id","typeLabel":"integer"},"purpose":{"type":"string","enum":["transactional","campaign"],"description":"Module the template belongs to. `transactional` templates are the ones you send single emails with; `campaign` templates are the ones the campaign builder can pick.","example":"campaign","isRequired":true,"uniqueKey":"data.purpose","typeLabel":"enum\u003cstring>"},"preparation_status":{"type":"string","enum":["pending","ready","failed"],"description":"How far the template has got through preparation. Creating or updating a template through the API defers image migration and HTML rendering to a background job, so the template is `pending` until that finishes. On a create with JSON there is no HTML at all yet - the editor works (it reads the JSON) but sending and the screenshot do not. On an update the previous render stays in place, so the template remains sendable, but it is still serving the *old* content until this reads `ready`. `failed` means preparation exhausted its retries and will not become ready on its own. A template created from raw HTML is `ready` immediately.","example":"ready","isRequired":true,"uniqueKey":"data.preparation_status","typeLabel":"enum\u003cstring>"},"active_version":{"type":"integer","description":"Version number of the active template version","example":1,"isRequired":true,"uniqueKey":"data.active_version","typeLabel":"integer"},"merge_tags":{"type":"array","description":"List of merge tags extracted from the template content","items":{"type":"object","description":"A single merge tag. Loop merge tags (for iterating over arrays) include a 'children' property with nested field definitions.","required":["key","required"],"properties":{"key":{"type":"string","description":"The merge tag key/name used in templates","example":"first_name","isRequired":true,"uniqueKey":"data.merge_tags.items.[INDEX].key","typeLabel":"string"},"required":{"type":"boolean","description":"Whether this merge tag is required when sending emails","example":true,"isRequired":true,"uniqueKey":"data.merge_tags.items.[INDEX].required","typeLabel":"boolean"},"type":{"type":"string","description":"The data type of the merge tag (only present for loop children)","enum":["text","number","image","button"],"example":"text","uniqueKey":"data.merge_tags.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"children":{"type":"array","description":"Child merge tags for loop blocks. Each child represents a field available within the loop iteration.","items":{"type":"object","description":"A child merge tag within a loop block","required":["key"],"properties":{"key":{"type":"string","description":"The child merge tag key/name","example":"item_name","isRequired":true,"uniqueKey":"data.merge_tags.items.[INDEX].children.items.[INDEX].key","typeLabel":"string"},"type":{"type":"string","description":"The data type of the child merge tag","enum":["text","number","image","button"],"example":"text","uniqueKey":"data.merge_tags.items.[INDEX].children.items.[INDEX].type","typeLabel":"enum\u003cstring>"}},"uniqueKey":"data.merge_tags.items.[INDEX].children.items.[INDEX]","typeLabel":"object"},"uniqueKey":"data.merge_tags.items.[INDEX].children","typeLabel":"object[]"}},"uniqueKey":"data.merge_tags.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"data.merge_tags","typeLabel":"object[]"},"created_at":{"type":"string","format":"date-time","description":"When the template was created","example":"2026-01-28T12:00:00+00:00","isRequired":true,"uniqueKey":"data.created_at","typeLabel":"string\u003cdate-time>"}},"isRequired":true,"uniqueKey":"data","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"example":{"message":"Template created successfully.","data":{"id":123,"name":"Welcome Email","slug":"welcome-email","project_id":5,"folder_id":10,"purpose":"transactional","preparation_status":"pending","active_version":1,"merge_tags":[{"key":"FIRST_NAME","required":true}],"created_at":"2026-01-28T12:00:00+00:00"}},"examples":{"Example":{"title":"Example","value":{"message":"Template created successfully.","data":{"id":123,"name":"Welcome Email","slug":"welcome-email","project_id":5,"folder_id":10,"purpose":"transactional","preparation_status":"pending","active_version":1,"merge_tags":[{"key":"FIRST_NAME","required":true}],"created_at":"2026-01-28T12:00:00+00:00"}}}},"exampleType":"examples"}},"exampleType":"examples"},"cb9280f5-867c-4dff-bb26-02e93a419af2":{"description":"Unauthorized - Missing or invalid API key","content":{"application/json":{"schema":{"type":"object","required":["message"],"description":"Error response for authentication failures (401).","properties":{"message":{"type":"string","description":"Human-readable error message","example":"API key is required.","isRequired":true,"uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"missing_key":{"title":"missing_key","summary":"Missing API key","value":{"message":"API key is required."}},"invalid_key":{"title":"invalid_key","summary":"Invalid API key","value":{"message":"Invalid API key."}}},"exampleType":"examples"}},"exampleType":"examples"},"68410f7b-5eed-45ce-96f2-63d5755822ec":{"description":"Project or folder not found","content":{"application/json":{"schema":{"type":"object","required":["message","error_code"],"description":"Error response for non-validation errors (400, 409, 500, 502).","properties":{"message":{"type":"string","description":"Human-readable error message","example":"The sender domain could not be determined from the email address.","isRequired":true,"uniqueKey":"message","typeLabel":"string"},"error_code":{"type":"string","description":"Error codes returned by the API.\n\n| Code | HTTP Status | Description |\n|------|-------------|-------------|\n| `validation_error` | 422 | Request validation failed. Check the `errors` object for field-specific messages. |\n| `invalid_domain` | 400 | The sender domain could not be determined from the email address. |\n| `unconfigured_domain` | 400 | The sender domain is not configured or approved for sending. |\n| `send_error` | 400, 500 | General error during email send preparation or domain registration. |\n| `retrieval_error` | 400, 500 | Failed to retrieve resources (e.g., sandbox key without associated user, upstream error). |\n| `internal_error` | 500 | An unexpected error on our side. The `message` names what failed; retry later. |\n| `transmission_failed` | 502 | Email transmission to the upstream provider failed. |\n| `resource_already_exists` | 409 | The resource (e.g., domain) already exists. |\n| `not_found` | 404 | The specified resource was not found. |\n| `template_not_found` | 404 | The specified template, project, or template version was not found. |\n| `insufficient_scope` | 403 | The API key does not have the required scope for this endpoint. |\n| `domain_not_allowed` | 403 | The sender domain is not in the API key's allowed sender domains. |\n| `schedule_cancellation_failed` | 409, 500 | The scheduled email can no longer be cancelled (already sent, already cancelled, or being injected right now), or the cancellation itself failed. |\n| `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your plan to continue sending. |\n| `daily_quota_exceeded` | 429 | Daily sending quota exceeded. Try again tomorrow. |\n| `campaign_not_sendable` | 422 | The campaign cannot be sent in its current state (not a draft, or missing subject/sender/content). |\n| `campaign_not_scheduled` | 422 | The campaign is not scheduled, so it cannot be unscheduled. |","enum":["validation_error","idempotency_key_conflict","idempotency_in_progress","invalid_domain","unconfigured_domain","send_error","retrieval_error","internal_error","transmission_failed","resource_already_exists","not_found","template_not_found","insufficient_scope","domain_not_allowed","schedule_cancellation_failed","quota_exceeded","daily_quota_exceeded","campaign_not_sendable","campaign_not_scheduled"],"example":"invalid_domain","isRequired":true,"uniqueKey":"error_code","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"examples":{"project_not_found":{"title":"project_not_found","summary":"Project not found","value":{"message":"Project with ID '123' was not found or you don't have access to it.","error_code":"not_found"}},"no_default_project":{"title":"no_default_project","summary":"No default project configured","value":{"message":"No default project is configured for this team.","error_code":"not_found"}},"folder_not_found":{"title":"folder_not_found","summary":"Folder not found","value":{"message":"Folder with ID '456' was not found in the specified project.","error_code":"not_found"}},"no_folders":{"title":"no_folders","summary":"No folders in project","value":{"message":"Project with ID '123' has no folders. Please create a folder first.","error_code":"not_found"}}},"exampleType":"examples"}},"exampleType":"examples"},"5d46361e-3bbe-41af-a949-80955bd4f43b":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","required":["message","error_code","errors"],"properties":{"message":{"type":"string","description":"Human-readable error message","example":"Validation failed.","isRequired":true,"uniqueKey":"message","typeLabel":"string"},"error_code":{"type":"string","description":"Error code (always `validation_error` for 422 responses)","const":"validation_error","example":"validation_error","isRequired":true,"uniqueKey":"error_code","typeLabel":"string"},"errors":{"type":"object","description":"Field-specific validation errors","additionalProperties":{"type":"array","items":{"type":"string","uniqueKey":"errors.additionalProperties.items.[INDEX]","typeLabel":"string"},"uniqueKey":"errors.additionalProperties","typeLabel":"string[]"},"example":{"from":["The sender email address is required."],"to":["At least one recipient email address is required."]},"isRequired":true,"uniqueKey":"errors","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"name_required":{"title":"name_required","summary":"Name is required","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"name":["The name field is required."]}}},"no_content":{"title":"no_content","summary":"No content provided","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"html":["Either html or json content is required."]}}},"both_content":{"title":"both_content","summary":"Both html and json provided","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"json":["The json and html fields are mutually exclusive. Provide only one."]}}},"invalid_json":{"title":"invalid_json","summary":"Invalid JSON syntax","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"json":["The provided JSON is not valid."]}}},"invalid_purpose":{"title":"invalid_purpose","summary":"Unknown purpose","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"purpose":["The purpose must be either transactional or campaign."]}}},"folder_purpose_mismatch":{"title":"folder_purpose_mismatch","summary":"Folder belongs to the other module","value":{"message":"Validation failed.","error_code":"validation_error","errors":{"folder_id":["Folder 10 is a transactional folder and cannot hold a campaign template."]}}}},"exampleType":"examples"}},"exampleType":"examples"},"8b15991e-77af-4c3b-a457-26e4aebd3a9d":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","required":["message","error_code"],"description":"Error response for non-validation errors (400, 409, 500, 502).","properties":{"message":{"type":"string","description":"Human-readable error message","example":"The sender domain could not be determined from the email address.","isRequired":true,"uniqueKey":"message","typeLabel":"string"},"error_code":{"type":"string","description":"Error codes returned by the API.\n\n| Code | HTTP Status | Description |\n|------|-------------|-------------|\n| `validation_error` | 422 | Request validation failed. Check the `errors` object for field-specific messages. |\n| `invalid_domain` | 400 | The sender domain could not be determined from the email address. |\n| `unconfigured_domain` | 400 | The sender domain is not configured or approved for sending. |\n| `send_error` | 400, 500 | General error during email send preparation or domain registration. |\n| `retrieval_error` | 400, 500 | Failed to retrieve resources (e.g., sandbox key without associated user, upstream error). |\n| `internal_error` | 500 | An unexpected error on our side. The `message` names what failed; retry later. |\n| `transmission_failed` | 502 | Email transmission to the upstream provider failed. |\n| `resource_already_exists` | 409 | The resource (e.g., domain) already exists. |\n| `not_found` | 404 | The specified resource was not found. |\n| `template_not_found` | 404 | The specified template, project, or template version was not found. |\n| `insufficient_scope` | 403 | The API key does not have the required scope for this endpoint. |\n| `domain_not_allowed` | 403 | The sender domain is not in the API key's allowed sender domains. |\n| `schedule_cancellation_failed` | 409, 500 | The scheduled email can no longer be cancelled (already sent, already cancelled, or being injected right now), or the cancellation itself failed. |\n| `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your plan to continue sending. |\n| `daily_quota_exceeded` | 429 | Daily sending quota exceeded. Try again tomorrow. |\n| `campaign_not_sendable` | 422 | The campaign cannot be sent in its current state (not a draft, or missing subject/sender/content). |\n| `campaign_not_scheduled` | 422 | The campaign is not scheduled, so it cannot be unscheduled. |","enum":["validation_error","idempotency_key_conflict","idempotency_in_progress","invalid_domain","unconfigured_domain","send_error","retrieval_error","internal_error","transmission_failed","resource_already_exists","not_found","template_not_found","insufficient_scope","domain_not_allowed","schedule_cancellation_failed","quota_exceeded","daily_quota_exceeded","campaign_not_sendable","campaign_not_scheduled"],"example":"invalid_domain","isRequired":true,"uniqueKey":"error_code","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"example":{"message":"Failed to create template. Please try again later.","error_code":"send_error"},"examples":{"Example":{"title":"Example","value":{"message":"Failed to create template. Please try again later.","error_code":"send_error"}}},"exampleType":"examples"}},"exampleType":"examples"},"085ce7ab-f8a1-48d9-ab1e-5f7dabac82cc":{"description":"Service unavailable - the API key could not be verified, so the request was not processed. This does not mean the key is invalid; retry after the delay given in the Retry-After header.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","example":5}}},"content":{"application/json":{"schema":{"type":"object","required":["message","error_code"],"description":"Error response for non-validation errors (400, 409, 500, 502).","properties":{"message":{"type":"string","description":"Human-readable error message","example":"The sender domain could not be determined from the email address.","isRequired":true,"uniqueKey":"message","typeLabel":"string"},"error_code":{"type":"string","description":"Error codes returned by the API.\n\n| Code | HTTP Status | Description |\n|------|-------------|-------------|\n| `validation_error` | 422 | Request validation failed. Check the `errors` object for field-specific messages. |\n| `invalid_domain` | 400 | The sender domain could not be determined from the email address. |\n| `unconfigured_domain` | 400 | The sender domain is not configured or approved for sending. |\n| `send_error` | 400, 500 | General error during email send preparation or domain registration. |\n| `retrieval_error` | 400, 500 | Failed to retrieve resources (e.g., sandbox key without associated user, upstream error). |\n| `internal_error` | 500 | An unexpected error on our side. The `message` names what failed; retry later. |\n| `transmission_failed` | 502 | Email transmission to the upstream provider failed. |\n| `resource_already_exists` | 409 | The resource (e.g., domain) already exists. |\n| `not_found` | 404 | The specified resource was not found. |\n| `template_not_found` | 404 | The specified template, project, or template version was not found. |\n| `insufficient_scope` | 403 | The API key does not have the required scope for this endpoint. |\n| `domain_not_allowed` | 403 | The sender domain is not in the API key's allowed sender domains. |\n| `schedule_cancellation_failed` | 409, 500 | The scheduled email can no longer be cancelled (already sent, already cancelled, or being injected right now), or the cancellation itself failed. |\n| `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your plan to continue sending. |\n| `daily_quota_exceeded` | 429 | Daily sending quota exceeded. Try again tomorrow. |\n| `campaign_not_sendable` | 422 | The campaign cannot be sent in its current state (not a draft, or missing subject/sender/content). |\n| `campaign_not_scheduled` | 422 | The campaign is not scheduled, so it cannot be unscheduled. |","enum":["validation_error","idempotency_key_conflict","idempotency_in_progress","invalid_domain","unconfigured_domain","send_error","retrieval_error","internal_error","transmission_failed","resource_already_exists","not_found","template_not_found","insufficient_scope","domain_not_allowed","schedule_cancellation_failed","quota_exceeded","daily_quota_exceeded","campaign_not_sendable","campaign_not_scheduled"],"example":"invalid_domain","isRequired":true,"uniqueKey":"error_code","typeLabel":"enum\u003cstring>"}},"uniqueKey":"","typeLabel":"object"},"example":{"message":"Unable to verify your API key right now. Please retry shortly.","error_code":"auth_unavailable"},"examples":{"Example":{"title":"Example","value":{"message":"Unable to verify your API key right now. Please retry shortly.","error_code":"auth_unavailable"}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"9a3f359c-ecd5-4491-8cf3-5ab8c4329186":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key for authentication","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"3a9a6297-5f46-49ab-955a-fb22c45ca41c":{"url":"https://app.lettr.com/api","description":"Production"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"API key for authentication","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"API key for authentication","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"openapi.json"},"subdomain":"lettr","siteName":"Lettr","title":"Create Template - Lettr","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-30T13:09:45.423Z","originalFileLocation":"api-reference/templates/create-template.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Lettr\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create Template - Lettr\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Lettr\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lettr.com/api-reference/templates/create-template\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lettr.mintlify.site/_mintlify/api/og/v2?division=Templates\u0026amp;title=Create+Template\u0026amp;description=Create+a+new+email+template+with+HTML+or+Topol+editor+JSON+content.+Automatically+creates+and+publishes+a+template+version+with+extracted+merge+tags.\u0026amp;theme=6d36e4ae9c92b67d8136c8c1\u0026amp;signature=a9e26a501e1db4a09ca97696184cba3ed76df883c4373210b1c1b424422956cb\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create Template - Lettr\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lettr.mintlify.site/_mintlify/api/og/v2?division=Templates\u0026amp;title=Create+Template\u0026amp;description=Create+a+new+email+template+with+HTML+or+Topol+editor+JSON+content.+Automatically+creates+and+publishes+a+template+version+with+extracted+merge+tags.\u0026amp;theme=6d36e4ae9c92b67d8136c8c1\u0026amp;signature=a9e26a501e1db4a09ca97696184cba3ed76df883c4373210b1c1b424422956cb\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lettr/dSsCtMUFma4ICJBo/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Lettr\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#EC104B\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lettr.com/api-reference/templates/create-template\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/templates/create-template.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lettr.com/#organization\",\"name\":\"Lettr\",\"url\":\"https://docs.lettr.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lettr/w6cQMnBCGTvjJ4__/logo/light.svg?fit=max\u0026auto=format\u0026n=w6cQMnBCGTvjJ4__\u0026q=85\u0026s=2cad5a94a80e61999cf9feaeac06e9c6\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lettr.com#website\",\"name\":\"Lettr\",\"url\":\"https://docs.lettr.com\",\"publisher\":{\"@id\":\"https://docs.lettr.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lettr.com/api-reference/templates/create-template#webpage\",\"url\":\"https://docs.lettr.com/api-reference/templates/create-template\",\"name\":\"Create Template\",\"description\":\"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\",\"dateModified\":\"2026-09-30T13:09:45.423Z\",\"isPartOf\":{\"@id\":\"https://docs.lettr.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lettr.com/api-reference/templates/create-template#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lettr.com/api-reference/templates/create-template#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Templates\",\"item\":\"https://docs.lettr.com/api-reference/templates/list-templates\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Template\",\"item\":\"https://docs.lettr.com/api-reference/templates/create-template\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.lettr.com/api-reference/templates/create-template#apireference\",\"headline\":\"Create Template\",\"name\":\"Create Template\",\"description\":\"Create a new email template with HTML or Topol editor JSON content. Automatically creates and publishes a template version with extracted merge tags.\",\"url\":\"https://docs.lettr.com/api-reference/templates/create-template\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lettr.com/api-reference/templates/create-template#webpage\"},\"dateModified\":\"2026-09-30T13:09:45.423Z\",\"publisher\":{\"@id\":\"https://docs.lettr.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lettr.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Lettr\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Lettr\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/templates/create-template.md","siteName":"Lettr","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"API Reference","groups":[{"group":"API Reference","pages":[{"title":"Introduction","href":"/api-reference/introduction"},{"title":"Rate Limit","href":"/api-reference/rate-limit"}]},{"group":"Emails","pages":[{"title":"Send Email","openapi":"POST /emails","href":"/api-reference/emails/send-email"},{"title":"Get Email Detail","openapi":"GET /emails/{requestId}","href":"/api-reference/emails/get-email-detail"},{"title":"List Email Events","openapi":"GET /emails/events","href":"/api-reference/emails/list-email-events"}]},{"group":"Scheduled Emails","pages":[{"title":"Schedule Email","openapi":"POST /emails/scheduled","href":"/api-reference/emails/schedule-email"},{"title":"List Scheduled Emails","openapi":"GET /emails/scheduled","href":"/api-reference/emails/list-scheduled-emails"},{"title":"Get Scheduled Email","openapi":"GET /emails/scheduled/{transmissionId}","href":"/api-reference/emails/get-scheduled-email"},{"title":"Cancel Scheduled Email","openapi":"DELETE /emails/scheduled/{transmissionId}","href":"/api-reference/emails/cancel-scheduled-email"}]},{"group":"Domains","pages":[{"title":"List Domains","openapi":"GET /domains","href":"/api-reference/domains/list-domains"},{"title":"Create Domain","openapi":"POST /domains","href":"/api-reference/domains/create-domain"},{"title":"Get Domain","openapi":"GET /domains/{domain}","href":"/api-reference/domains/get-domain"},{"title":"Delete Domain","openapi":"DELETE /domains/{domain}","href":"/api-reference/domains/delete-domain"},{"title":"Verify Domain","openapi":"POST /domains/{domain}/verify","href":"/api-reference/domains/verify-domain"}]},{"group":"Templates","pages":[{"title":"List Templates","openapi":"GET /templates","description":"Retrieve a paginated list of email templates for a project. If `project_id` is not provided, templates from the team's default project will be returned.","href":"/api-reference/templates/list-templates"},{"title":"Create Template","openapi":"POST /templates","href":"/api-reference/templates/create-template"},{"title":"Get Template","openapi":"GET /templates/{slug}","description":"Retrieve a single email template by its slug. If `project_id` is not provided, the template will be looked up in the team's default project.","href":"/api-reference/templates/get-template"},{"title":"Update Template","openapi":"PUT /templates/{slug}","href":"/api-reference/templates/update-template"},{"title":"Delete Template","openapi":"DELETE /templates/{slug}","href":"/api-reference/templates/delete-template"},{"title":"Get Merge Tags","openapi":"GET /templates/{slug}/merge-tags","href":"/api-reference/templates/get-merge-tags"},{"title":"List Folders","openapi":"GET /folders","href":"/api-reference/templates/list-folders"}]},{"group":"Webhooks","pages":[{"title":"List Webhooks","openapi":"GET /webhooks","href":"/api-reference/webhooks/list-webhooks"},{"title":"Create Webhook","openapi":"POST /webhooks","href":"/api-reference/webhooks/create-webhook"},{"title":"Get Webhook","openapi":"GET /webhooks/{webhookId}","href":"/api-reference/webhooks/get-webhook"},{"title":"Update Webhook","openapi":"PUT /webhooks/{webhookId}","href":"/api-reference/webhooks/update-webhook"},{"title":"Delete Webhook","openapi":"DELETE /webhooks/{webhookId}","href":"/api-reference/webhooks/delete-webhook"}]},{"group":"System","pages":[{"title":"Health Check","openapi":"GET /health","href":"/api-reference/system/health-check"},{"title":"Auth Check","openapi":"GET /auth/check","href":"/api-reference/system/auth-check"}]},{"group":"Campaigns","pages":[{"title":"Create a campaign","openapi":"POST /campaigns","href":"/api-reference/campaigns/create-a-campaign"},{"title":"List campaigns","openapi":"GET /campaigns","href":"/api-reference/campaigns/list-campaigns"},{"title":"Show a campaign","openapi":"GET /campaigns/{campaignId}","href":"/api-reference/campaigns/show-a-campaign"},{"title":"List campaign engagement events","openapi":"GET /campaigns/{campaignId}/events","href":"/api-reference/campaigns/list-campaign-engagement-events"},{"title":"Send a campaign now","openapi":"POST /campaigns/{campaignId}/send","href":"/api-reference/campaigns/send-a-campaign-now"},{"title":"Schedule a campaign","openapi":"POST /campaigns/{campaignId}/schedule","href":"/api-reference/campaigns/schedule-a-campaign"},{"title":"Unschedule a campaign","openapi":"POST /campaigns/{campaignId}/unschedule","href":"/api-reference/campaigns/unschedule-a-campaign"}]},{"group":"Audience Lists","pages":[{"title":"List audience lists","openapi":"GET /audience/lists","href":"/api-reference/audience/list-audience-lists"},{"title":"Create an audience list","openapi":"POST /audience/lists","href":"/api-reference/audience/create-an-audience-list"},{"title":"Bulk delete audience lists","openapi":"DELETE /audience/lists/bulk","href":"/api-reference/audience/bulk-delete-audience-lists"},{"title":"Show an audience list","openapi":"GET /audience/lists/{listId}","href":"/api-reference/audience/show-an-audience-list"},{"title":"Update an audience list","openapi":"PATCH /audience/lists/{listId}","href":"/api-reference/audience/update-an-audience-list"},{"title":"Delete an audience list","openapi":"DELETE /audience/lists/{listId}","href":"/api-reference/audience/delete-an-audience-list"}]},{"group":"Audience Contacts","pages":[{"title":"List audience contacts","openapi":"GET /audience/contacts","href":"/api-reference/audience/list-audience-contacts"},{"title":"Create a contact","openapi":"POST /audience/contacts","href":"/api-reference/audience/create-a-contact"},{"title":"Bulk create contacts","openapi":"POST /audience/contacts/bulk","href":"/api-reference/audience/bulk-create-contacts"},{"title":"Bulk attach contacts to lists","openapi":"POST /audience/contacts/lists/bulk","href":"/api-reference/audience/bulk-attach-contacts-to-lists"},{"title":"Bulk detach contacts from lists","openapi":"DELETE /audience/contacts/lists/bulk","href":"/api-reference/audience/bulk-detach-contacts-from-lists"},{"title":"Bulk subscribe contacts to topics","openapi":"POST /audience/contacts/topics/bulk","href":"/api-reference/audience/bulk-subscribe-contacts-to-topics"},{"title":"Bulk unsubscribe contacts from topics","openapi":"DELETE /audience/contacts/topics/bulk","href":"/api-reference/audience/bulk-unsubscribe-contacts-from-topics"},{"title":"Show a contact","openapi":"GET /audience/contacts/{contactId}","href":"/api-reference/audience/show-a-contact"},{"title":"Update a contact","openapi":"PATCH /audience/contacts/{contactId}","href":"/api-reference/audience/update-a-contact"},{"title":"Delete a contact","openapi":"DELETE /audience/contacts/{contactId}","href":"/api-reference/audience/delete-a-contact"},{"title":"Attach contact to list","openapi":"POST /audience/contacts/{contactId}/lists/{listId}","href":"/api-reference/audience/attach-contact-to-list"},{"title":"Detach contact from list","openapi":"DELETE /audience/contacts/{contactId}/lists/{listId}","href":"/api-reference/audience/detach-contact-from-list"},{"title":"Subscribe contact to topic","openapi":"POST /audience/contacts/{contactId}/topics/{topicId}","href":"/api-reference/audience/subscribe-contact-to-topic"},{"title":"Unsubscribe contact from topic","openapi":"DELETE /audience/contacts/{contactId}/topics/{topicId}","href":"/api-reference/audience/unsubscribe-contact-from-topic"}]},{"group":"Audience Topics","pages":[{"title":"List audience topics","openapi":"GET /audience/topics","href":"/api-reference/audience/list-audience-topics"},{"title":"Create a topic","openapi":"POST /audience/topics","href":"/api-reference/audience/create-a-topic"},{"title":"Show a topic","openapi":"GET /audience/topics/{topicId}","href":"/api-reference/audience/show-a-topic"},{"title":"Update a topic","openapi":"PATCH /audience/topics/{topicId}","href":"/api-reference/audience/update-a-topic"},{"title":"Delete a topic","openapi":"DELETE /audience/topics/{topicId}","href":"/api-reference/audience/delete-a-topic"}]},{"group":"Audience Properties","pages":[{"title":"List audience properties","openapi":"GET /audience/properties","href":"/api-reference/audience/list-audience-properties"},{"title":"Create a property","openapi":"POST /audience/properties","href":"/api-reference/audience/create-a-property"},{"title":"Show a property","openapi":"GET /audience/properties/{propertyId}","href":"/api-reference/audience/show-a-property"},{"title":"Update a property","openapi":"PATCH /audience/properties/{propertyId}","href":"/api-reference/audience/update-a-property"},{"title":"Delete a property","openapi":"DELETE /audience/properties/{propertyId}","href":"/api-reference/audience/delete-a-property"}]},{"group":"Audience Segments","pages":[{"title":"List audience segments","openapi":"GET /audience/segments","href":"/api-reference/audience/list-audience-segments"},{"title":"Create a segment","openapi":"POST /audience/segments","href":"/api-reference/audience/create-a-segment"},{"title":"Show a segment","openapi":"GET /audience/segments/{segmentId}","href":"/api-reference/audience/show-a-segment"},{"title":"Update a segment","openapi":"PATCH /audience/segments/{segmentId}","href":"/api-reference/audience/update-a-segment"},{"title":"Delete a segment","openapi":"DELETE /audience/segments/{segmentId}","href":"/api-reference/audience/delete-a-segment"}]}]},{"tab":"Knowledge Base","pages":[{"title":"Knowledge Base","href":"/knowledge-base/introduction"}]}]},"basePath":"","title":"Create Template - Lettr","deploymentId":"dpl_FZMKUpaaKiVETbfqhoUe4sPFDTmY","buildId":"dpl_FZMKUpaaKiVETbfqhoUe4sPFDTmY","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-B6WFFOBL.js","utils-BN5um1KA.js","cloneDeep-C3md22mN.js","_Uint8Array-DLlL8L26.js","isObject-FP1Yky1u.js","utils-BSmbkXJR.js","addUniqueKeysToSchema-2tqcVnUE.js","snippetPresets-CtWfvr2J.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-DkKHBy30.js","isEqual-O3q7y6pq.js","usePlaygroundInputsStore-Brc5H9UJ.js","shallow-C4L4xvbs.js","getApiPlaygroundDisplay-2bxyq_aI.js","CodeSnippet-BJu8ddd5.js","CodeSnippets-dazWmoqB.js","Page-CnLhKuUV.js","getPastedJson-Chy3Qa1S.js","icon-CyO7h3jh.js","MethodPill-Dle0_91v.js","DuplicateIcon-CVvWAf4a.js","createIcon-Di07A27B.js","DynamicMarkdown-C4w9kavL.js","SectionHeading-XiBebVYC.js","axios-vUo_bRtp.js","Markdown-DTeL0SpS.js","dist-OCScizqf.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","katex-YMM-FMeD.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","AssistantPageLink-KcneGfMY.js"]}