# Create email template API

> Create email template API reference: POST /templates creates a template draft with HTML, an alias, a subject and variables, ready to publish.

Canonical: https://www.cresca.xyz/docs/api-reference/create-template
Last updated: 2026-11-05

Use the create email template API to create a template draft that your app can send once it is published.

POST https://api.cresca.xyz/api/v1/templates

Requires a full-access key. The template starts as a draft; call [Publish template](https://www.cresca.xyz/docs/api-reference/publish-template) before sending with it. It also appears under Transactional → Templates in the Cresca app, where you can edit it, send a test and see its version history.

### Body parameters

name string required

Template name, up to 120 characters, unique in your account.

html string required

HTML body. Use `{{{VARIABLE}}}` placeholders for values your app sends.

alias string optional

A readable id for sending, such as `password-reset`: lowercase letters, numbers, dashes and underscores, up to 64 characters, starting with a letter or number and unique in your account. Uppercase letters are converted to lowercase.

subject string optional

Default subject. Can contain variables.

text string optional

Plain-text version. If omitted, it is generated from the HTML at send time.

from string optional

Default sender, for example `Acme <hello@acme.com>`. It is checked against your verified senders when an email is sent with the template, not when the template is saved.

reply\_to string optional

Default Reply-To address. One address; if you send an array, only the first is kept.

preview\_text string optional

The snippet inbox apps show after the subject, up to 500 characters. Can contain variables.

variables object\[\] optional

Variable definitions: `{ "key": "NAME", "type": "string", "fallback_value": "there" }`. `type` is `string` (default) or `number`. Up to 50. See [Templates and variables](https://www.cresca.xyz/docs/templates).

## Create email template API example

Request

```bash
curl -X POST 'https://api.cresca.xyz/api/v1/templates' \
  -H 'Authorization: Bearer cr_live_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Password reset",
  "alias": "password-reset",
  "subject": "Reset your password",
  "from": "Acme <hello@acme.com>",
  "html": "<p>Hi {{{NAME}}},</p><p><a href=\"{{{RESET_LINK}}}\">Reset your password</a>. The link expires in 1 hour.</p>",
  "variables": [
    {
      "key": "NAME",
      "type": "string",
      "fallback_value": "there"
    },
    {
      "key": "RESET_LINK",
      "type": "string"
    }
  ]
}'
```

Response 201

```json
{
  "object": "template",
  "id": "6713b1f4c2a94e0012ab34cd"
}
```

[Previous Cancel email](https://www.cresca.xyz/docs/api-reference/cancel-email) [Next Retrieve template](https://www.cresca.xyz/docs/api-reference/retrieve-template)

Last updated November 5, 2026. Questions? [lalit@cresca.xyz](mailto:lalit@cresca.xyz)
