> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Transactional Email

> Create a saved transactional email template

Create a transactional email template with exactly one content source: `prompt` for Sequenzy-generated transactional blocks, `blocks` for finished caller-supplied content, or `html` for preserved/imported markup. Prompt-created templates default to disabled; explicit HTML or blocks retain the compatibility default of enabled. Generated transactional footers omit unsubscribe treatment.

## Request

<ParamField body="name" type="string" required>
  Transactional email name.
</ParamField>

<ParamField body="slug" type="string">
  API slug used when sending by slug. If omitted, Sequenzy generates one from
  the name.
</ParamField>

<ParamField body="subject" type="string">
  Email subject line. Required with `html` or `blocks`; optional with `prompt`,
  where it overrides the generated subject.
</ParamField>

<ParamField body="previewText" type="string">
  Optional preview override. With `prompt`, the generated preview is used when
  this field is omitted. Pass `null` to suppress preview text.
</ParamField>

<ParamField body="prompt" type="string">
  Natural-language request for Sequenzy to generate branded transactional blocks
  with a footer that omits unsubscribe treatment.
</ParamField>

<ParamField body="style" type="string">
  Optional generation style. Valid only with `prompt`.
</ParamField>

<ParamField body="tone" type="string">
  Optional generation tone. Valid only with `prompt`.
</ParamField>

<ParamField body="html" type="string">
  Raw HTML body. Provide either `html` or `blocks`, not both.
</ParamField>

<ParamField body="blocks" type="array">
  Sequenzy email blocks. Provide either `blocks` or `html`, not both. Put block
  styling under `styles`; top-level style keys like `backgroundColor`,
  `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are
  normalized into `styles`.
</ParamField>

<ParamField body="enabled" type="boolean">
  Whether this transactional email can be sent immediately. Defaults to `false`
  with `prompt` and `true` with explicit `html` or `blocks`.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/transactional" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Password Reset",
    "slug": "password-reset",
    "prompt": "Write a concise password reset email using {{RESET_URL}}"
  }'
```

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/transactional" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Password Reset",
    "slug": "password-reset",
    "subject": "Reset your password, {{NAME}}",
    "previewText": "Use this link to reset your password.",
    "html": "<p>Reset link: {{RESET_URL}}</p>"
  }'
```

## Responses

<ResponseExample>
  ```json 201 theme={null}
  {
    "success": true,
    "transactional": {
      "id": "txn_abc123",
      "name": "Password Reset",
      "slug": "password-reset",
      "emailId": "email_abc123",
      "enabled": true,
      "subject": "Reset your password, {{NAME}}",
      "previewText": "Use this link to reset your password.",
      "blocks": [
        {
          "id": "block_123",
          "type": "text",
          "content": "<p>Reset link: {{RESET_URL}}</p>",
          "variant": "html"
        }
      ],
      "variables": ["NAME", "RESET_URL"],
      "createdAt": "2026-05-01T10:30:00Z",
      "updatedAt": "2026-05-01T10:30:00Z"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Provide exactly one of prompt, html, or blocks."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "No sender profile configured. Please create a sender profile first."
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Unauthorized"
  }
  ```

  ```json 409 theme={null}
  {
    "success": false,
    "error": "A transactional email with slug \"password-reset\" already exists"
  }
  ```

  ```json 500 theme={null}
  {
    "success": false,
    "error": "Internal server error"
  }
  ```
</ResponseExample>
