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

# Create / Update Email Template

> Register or replace a transactional email template override for an event

Registers (or replaces) your app's HTML override for a transactional email
`event`. This is an **upsert** keyed by `(store, app, event)` — posting the
same `event` again replaces the previous override. When enabled, your HTML is
used in place of the platform default the next time that email is sent.

**Auth:** OAuth access token with the `write_email_templates` scope.

See [Email template extensions](/extensions/email-templates) for the supported
`event` names and the template variables available to each.

## Body Parameters

<ParamField body="event" type="string" required>
  The transactional event this template overrides (e.g. `order_confirmation`,
  `order_cancellation`, `shipment_notification`, `newsletter_welcome`,
  `abandoned_cart`).
</ParamField>

<ParamField body="htmlBody" type="string" required>
  The HTML body to send for this event. May reference the event's template
  variables.
</ParamField>

<ParamField body="subject" type="string">
  Subject line override. Defaults to the platform subject for the event when
  omitted.
</ParamField>

<ParamField body="enabled" type="boolean" default="true">
  Whether the override is active. Set `false` to keep the row but fall back to
  the platform default at send time.
</ParamField>

## Request

```json theme={null}
{
  "event": "order_confirmation",
  "subject": "Your order is confirmed 🎉",
  "htmlBody": "<h1>Thanks {{ customer.first_name }}!</h1><p>Order {{ order.name }} is confirmed.</p>",
  "enabled": true
}
```

## Response

```json theme={null}
{
  "template": {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "event": "order_confirmation",
    "subject": "Your order is confirmed 🎉",
    "htmlBody": "<h1>Thanks…</h1>",
    "enabled": true
  }
}
```

## Errors

| Status | Body                                             | Cause                                          |
| ------ | ------------------------------------------------ | ---------------------------------------------- |
| `400`  | `{ "error": "event and htmlBody are required" }` | `event` or `htmlBody` missing.                 |
| `403`  | `{ errors: { base: [...] } }`                    | Token lacks the `write_email_templates` scope. |
