---
title: "Create email template"
method: POST
path: "/api/templates/email/upsert"
tags: ["templates"]
---

# Create email template

`POST /api/templates/email/upsert`

Create email template if it doesn't exist already, otherwise update all email templates that match the name provided.

## Request body

- UpsertEmailTemplateModel
  - `bccEmails` string[] — BCC emails
  - `cacheDataFeed` object — Cache data feed lookups for 1 hour
  - `campaignDataFields` object — Campaign-level data fields available as {{field}} merge parameters during message rendering. These fields are overridden by user and event data fields of the same name.
  - `ccEmails` string[] — CC emails
  - `clientTemplateId` string, required — ID used by the client to identify a template. If multiple templates exist with the ID, all will be updated
  - `creatorUserId` string — Specify a specific creator user id (email). The email must be an existing member of the project. Defaults to the organization creator.
  - `dataFeedId` integer — [Deprecated - use dataFeedIds instead] Id for data feed used in template rendering
  - `dataFeedIds` number[] — Ids for data feeds used in template rendering
  - `fromEmail` string — From email (must be an authorized sender)
  - `fromName` string — From name
  - `googleAnalyticsCampaignName` string — Google analytics utm_campaign value
  - `html` string — HTML contents
  - `isDefaultLocale` boolean — Ask your Iterable CSM to enroll you in the beta for this feature. Sets the locale associated with the request content as the template’s default. If empty or flexible default locales are not enabled for the project, the project’s default locale is assigned.
  - `linkParams` LinkParam[] — Parameters to append to each URL in html contents
    - `key` string, required — Link parameter key
    - `value` string, required — Link parameter value
  - `locale` string — The locale for the content in this request. Iterable will automatically pick the content with locale that matches a 'locale' field in the user profile.
  - `mergeDataFeedContext` boolean — Merge data feed contents into user context, so fields be referenced by {{field}} instead of [[field]]
  - `messageTypeId` integer — Message Type Id
  - `name` string — Name of the template
  - `plainText` string — Plain text contents
  - `preheaderText` string — Preheader text
  - `replyToEmail` string — Reply to email
  - `subject` string — Subject

## Response `200`

successful operation

## Other responses

- `400` — Invalid parameters
- `401` — Invalid API key

---

[API](https://skmtc.net/iterable/apis/iterable-api.md) · [All operations](https://skmtc.net/iterable/apis/iterable-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/iterable/iterable-api/revisions/afaab604b58c/schema)
