---
title: "Create an email template"
method: POST
path: "/email-templates"
tags: ["Email"]
---

# Create an email template

`POST /email-templates`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/email-templates`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `messages:write`)

A template has a name, a subject and html or text with variables: {{name}}, or {{name|there}} with a fallback when the value is missing. Values in html are escaped. style site (default) puts the email in the style of the project's site: its name, logo and colors. Send it with POST /emails and template_id plus data, use it in an automation or a sequence, or preview it first. At most 200 templates per project.

## Request body

- object
  - `name` string, required: A name for the template, unique in the project, like "Welcome" or "Order shipped".
  - `subject` string, required: The subject, with variables like {{name}}.
  - `html` string: The HTML body with variables, like <p>Hi {{name|there}},</p>. Values are escaped. No scripts or forms.
  - `text` string: The plain text body with variables. Without it, the text comes from the html.
  - `style` 'site' | 'none': site (default): the email gets the name, logo and colors of the project's site around it. none: the html is sent as it is.
  - `site_id` string, uuid: Optional. The site whose style to use; without it the project's first site.

## Response `201`

The template.

- object
  - `id` string, uuid, required
  - `name` string, required
  - `subject` string, required
  - `html` string, nullable, required
  - `text` string, nullable, required
  - `style` 'site' | 'none', required: site: the name, logo and colors of the project's site around the email. none: sent as it is.
  - `site_id` string, uuid, nullable, required
  - `variables` string[], required: The variables in the subject and content, like name or order_number.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required.
- `409`: Conflict: conflict.
- `422`: Unprocessable Content: validation_failed.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
