---
title: Store API keys and passwords as secrets
description: >-
  Keep API keys, tokens and SMTP passwords out of your templates. Create
  encrypted secrets and reference them as {{ secrets.keyName }} in requests
  and emails.
source_url:
  html: >-
    https://docs.workflow-transactional-email.app/secrets
  md: >-
    https://docs.workflow-transactional-email.app/secrets.md
---

# Secrets

A **secret** is a named, encrypted value - an API key, a bearer token, a password. You store it once and reference it by name, so the value itself never appears in a request template, an email layout, or your history.

![The Secrets page](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/d99311f593b58a4e.png)

## Creating a secret

Open **Secrets** and click **Create secret**.

![The Secrets page with the Create secret button](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/e45ae9d7206b7dac.png)

| Field | Notes |
| --- | --- |
| **Name** | Letters, numbers and underscores only. Must be unique. Cannot be changed later |
| **Secret value** | The value itself |
| **Description** | Optional, up to 1024 characters. Worth filling in - future you will not remember which token this was |

![Entering a secret key, value and description](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/53048ce7631d1235.png)

The name is fixed after creation because changing it would break every template referencing it. To rename, create a new secret, update the references, then delete the old one.

![The Create secret form with a key and a masked value](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/87589ae080802c0d.png)
*A new secret: the key is what you reference, the value is stored encrypted and never shown again.*

## Using a secret

Reference it with `{{ secrets.keyName }}`:

```
Authorization: Bearer {{ secrets.airtableAccessToken }}
```

Secrets work in:

- HTTP request URLs, headers and bodies
- SMTP username and password fields
- Email subjects and bodies, including visual-builder text fields

![The Secrets page listing a saved secret with its Liquid reference](https://cdn-dev.eu.codecreationlabs.cloud/crm-tool/uploads/SjJ78gKLnLlocopCui3Cs62dJbGZ7F1n/e2df256a9adc3086.png)
*Every secret shows the reference to copy into a layout, a request or an SMTP login.*

> [!WARNING]
> The syntax is exact. `{{ secrets.keyName }}` works. `{{ secret.keyName }}` (singular) and `{{ secrets['keyName'] }}` (brackets) do not, and because templates render leniently they fail silently, leaving a blank where the value should be. Names are case-sensitive.

The editor sidebar has an **Available Secrets** card listing your keys as clickable badges - click one to copy the correct syntax rather than typing it. Hovering shows a masked preview so you can confirm you picked the right one.

## How secrets are protected

- Values are envelope-encrypted at rest with Cloud KMS and decrypted only while an action is running. Plaintext is never persisted.
- The Secrets list shows `********`, never the value - the page does not even receive it.
- Secret values are redacted from request data before it is written to History, so a stored token cannot leak through your own logs.
- Sidekick can tell you a secret *exists*, but never its value.

The edit page does show the current value, so you can correct a mistyped token.

## Verifying a secret resolves

Because a wrong name renders as an empty string rather than an error, check your work:

- For an HTTP request, use **Test** and read the **Resolved URL** and **Resolved Body** in the result card.
- For an email, use **Send test email**.
- After a live run, open the entry in **History** and inspect the request data.

## Editing or deleting a secret

Both take effect immediately, everywhere that secret is used, across your whole store.

The app scans your HTTP requests, SMTP servers and email layouts for references and shows you what it found - both on the page and again in the delete confirmation, naming each affected item.

**It will not stop you.** You can delete a secret that is still in use; the app just makes sure you know first.

> [!WARNING]
> A deleted secret does not raise an error at send time. The reference simply renders as an empty string, which usually surfaces as a `401 Unauthorized` from the destination API, or an SMTP login failure. If you delete one by mistake, recreate it with the same name and everything resumes working.

## Related

- [Make an HTTP request from Shopify Flow](https://docs.workflow-transactional-email.app/make-an-http-request.md) - secrets in a worked example.
- [Variables and Liquid](https://docs.workflow-transactional-email.app/variables-and-liquid.md) - the full templating reference.
- [History and troubleshooting](https://docs.workflow-transactional-email.app/history-and-troubleshooting.md) - confirming what was actually sent.
