> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/emails/templates/delete.md).

# Delete a template

Delete an email template for good.

**Where:** Email → Templates → a template → **Actions → Delete** · `/projects/<project>/emails/templates/<templateId>/edit`

Delete removes a template for good. To only take it out of use, [archive it](/codemash/cloud/emails/templates/publish.md) instead.

## Before you start

* Permission `email:delete` (built-in **Developer** or **Administrator**).
* The template is not used by a trigger or an authentication flow — such a template cannot be deleted (`CM-ERRORS-TEMPLATES-010`). Change the trigger first. See [Message templates](/codemash/cloud/concepts/message-templates.md).

## Steps

1. Open the template, for example `Old promo`, and open **Actions**.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-6488474bedeceedfc19227821cf6e5d8ca2c40ce%2Ftemplates-delete-1.png?alt=media" alt="Actions menu of the Old promo template with Delete at the bottom"><figcaption><p><strong>Delete</strong> in the Actions menu.</p></figcaption></figure>
2. Press **Delete**. The dialog **Delete Confirmation** asks "Are you sure you want to delete?".

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-30a910956eae35a6a5e156ccdb5c76764e5abd46%2Ftemplates-delete-2.png?alt=media" alt="Delete Confirmation dialog: Are you sure you want to delete? Cancel and Delete buttons"><figcaption><p>The confirmation dialog.</p></figcaption></figure>
3. Press **Delete**.

## Result

When Norbix has removed it you are back on **Email → Templates** and the template is gone. Campaigns already sent keep their message logs.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-af48e1245008d33062c317275c5543d9a7cb5bdf%2Ftemplates-delete-3.png?alt=media" alt="Email Templates list without Old promo"><figcaption><p>The list after the delete.</p></figcaption></figure>

## Change or remove it later

A deleted template cannot be brought back. Create it again ([Create or edit a template](/codemash/cloud/emails/templates/editor.md)) — it gets a new id, so update every trigger and every piece of code that used the old one.

## Do it from code

```ts
await norbix.hub.notifications.deleteEmailTemplate({ id }); // id = 'tmpl_…'
```

```sh
norbix hub notifications email template delete --id tmpl_5Gnn8fwtfaJ629mKO1bCI4 --yes
```

API: [Delete Email Template](/codemash/api-reference/notifications/email/delete-email-template.md)
