Skip to main content

After an admin has configured a secret store, you can reference secrets anywhere in Superblocks using the {{sb_secrets}} object.

Referencing secrets

Secrets are accessed from their respective stores using the syntax:
{{sb_secrets.STORE_NAME.SECRET_NAME}}
Secrets are available to reference in Backend APIs and Integrations. For security purposes, secrets cannot be referenced in Frontend JS or Components. Secrets are fetched at runtime from a particular store based on the API’s current Profile.

JSON secrets

If your secret is stored as a JSON object in key:value form, use the JavaScript JSON.parse() function to reference the secret value:
{{JSON.parse(sb_secrets.STORE_NAME.SECRET_NAME).SECRET_KEY}}

Special characters

If your secret name includes spaces or special characters, use array notation instead of dot notation:
{{sb_secrets.STORE_NAME['SECRET_NAME']}}

Caching

An admin can configure caching for each secret store to reduce calls to the secrets manager and improve API performance. If you’ve recently rotated a secret and aren’t seeing the new value, ask your admin to clear the cache for that secret store.
For more information on setting up and managing secret stores, see the Secrets Management admin guide.