> 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/sms/templates/publish.md).

# Archive or unarchive a template

An SMS template is live as soon as it is saved — archive it to take it out of use, unarchive it to use it again.

**Where:** SMS → Templates → a template → **Actions** → **Archive** / **Unarchive** · `/projects/<project>/sms/templates/<id>/edit`

SMS templates have **no publish step and no drafts**: a template can be used by campaigns and triggers as soon as you press **Create** or **Update**. To take one out of use without deleting it, archive it.

## Before you start

* The template is saved and has no unsaved changes.
* No trigger uses it: **Archive** is refused while a trigger sends it (`CM-ERRORS-TEMPLATES-010`).
* You need `sms:update` on SMS templates.

## Steps

1. Open the template, for example `Old promo`, and open **Actions**. **Archive** is on while the template is active; **Unarchive** is greyed out.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-8605dad574a3534dfa10065ff3b9dbb4efcd02ba%2Ftemplates-publish-1.png?alt=media" alt="The Actions menu of the active template Old promo: Create Campaign, Archive, Unarchive greyed out, Clone, See documentation, Delete"><figcaption><p>Archive on an active template.</p></figcaption></figure>
2. Press **Archive**.

## Result

The template stays in the [templates list](/codemash/cloud/sms/templates.md) with **Is Active** = **No**. It is no longer offered in the template pickers of campaigns, trigger actions and scheduler tasks, and it cannot be updated.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-fa55a289c50a8c35aaf9a43f4ad172a20e1dc403%2Ftemplates-publish-2.png?alt=media" alt="SMS Templates list with Old promo, Marketing, Is Active No"><figcaption><p>Old promo is archived.</p></figcaption></figure>

## Change or remove it later

* **Unarchive** — open the template again; now **Unarchive** is on and **Archive** is greyed out. Press **Unarchive** and the template is active again.

  <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-adc9328d8909021899e8615172351297279d11a2%2Ftemplates-publish-3.png?alt=media" alt="The Actions menu of the archived template Old promo: Archive greyed out, Unarchive on"><figcaption><p>Unarchive on an archived template.</p></figcaption></figure>
* **Delete** — see [Delete a template](/codemash/cloud/sms/templates/delete.md).

## Do it from code

The SDK sends the template id only in the address, but the gateway also reads it from the body; pass it a second time as `Id` until this is fixed.

```ts
// The SDK puts the id only into the address; the gateway also wants it in the body (Id).
await norbix.hub.notifications.archiveSmsTemplate({ id, Id: id } as any);
await norbix.hub.notifications.unArchiveSmsTemplate({ id, Id: id } as any);
```

```sh
norbix raw -X PUT /v2/notifications/sms/templates/tmpl_3bcdCrS0qxS08xsC6QbSTb/archive -b '{"id":"tmpl_3bcdCrS0qxS08xsC6QbSTb"}'
```

`norbix hub notifications sms template archive` fails the same way today, so the CLI line uses `norbix raw` (`…/unarchive` to undo). The client setup is on the [SMS page](/codemash/cloud/sms.md#use-it-from-code). API: [Archive Sms Template](/codemash/api-reference/notifications/sms/archive-sms-template.md) · [Un Archive Sms Template](/codemash/api-reference/notifications/sms/un-archive-sms-template.md)
