Skip to main content
The secrets module lets automations securely store and retrieve sensitive values (API keys, tokens, credentials) at runtime. Values are encrypted at rest and never exposed as plaintext in automation outputs or logs.

How it works

  1. secrets.set and secrets.get return an opaque secret reference (a $secret:... string), not the actual value.
  2. When this reference is used inside a fetch instruction (in the URL, headers, body, query, or auth fields), the platform automatically resolves it to the real value just before the HTTP call.
  3. The resolved value is redacted from all logs and events.
Secret references are short-lived (a few minutes). Always call secrets.get right before using the reference — do not store it for later reuse.

Scopes

Functions

set — Store or update a secret

Returns a $secret:... reference string. If a secret with the same name and scope already exists, it is updated.

get — Retrieve a secret reference

Returns a $secret:... reference string, or { error: "not_found" } if the secret does not exist (or has expired).

delete — Remove a secret

Returns { deleted: true } on success, or { error: "not_found" }.

Using secret references in fetch

Pass the reference returned by set or get wherever a sensitive value is needed in a fetch instruction. The platform resolves it transparently:
Resolution is supported in these fetch fields: url, headers, body, query, and auth (including auth.awsv4).
Secret references expire after a few minutes. Always retrieve the reference (secrets.get) in the same automation run where you use it.

Complete example — storing and using an OAuth token

Error handling

All three functions return an error object instead of throwing when the error is actionable: Use onError or a conditions block to handle these: