Neisian
Neisian5w ago

use secrets value in conditional steps and API body

how do i use secret variable in the conditional step and also in the api body request? I can`t seem to switch to the secrets tab when selecting the variable
1 Reply
Tico | Voiceflow Assistant
Quick recap of what’s possible today 1. Secrets are only resolved inside API and Function steps.
• Those two steps hide the actual value at run-time and send it server-side.
2. The Condition step’s variable picker does not expose the Secrets tab, so a secret can’t be read or compared there. --- How to insert a secret in an API step 1. Drop an API step.
2. Click into any field that accepts variables (URL, headers, body, etc.).
3. Type an opening curly brace { → the variable picker opens.
4. At the top of the picker switch to “Secrets” and choose your secret.
• If you haven’t created it yet, click Create secret at the bottom of the list. Voiceflow will substitute the secret’s value at execution time while keeping it masked in the canvas and logs. --- What to do if you need the secret inside a Condition Because secrets can’t be referenced directly in a Condition step, use an intermediate step:
[API / Function] → sets regular variable → [Condition]
[API / Function] → sets regular variable → [Condition]
Example: 1. Add a short JavaScript or Function step before the Condition.
my_api_key = SECRETS["API_KEY"]; // copy secret into normal var

my_api_key = SECRETS["API_KEY"]; // copy secret into normal var

2. The Condition step can now evaluate my_api_key like any other variable. (This keeps the secret value inside backend memory; it is never shown to the end user.) --- Summary • Use secrets directly in API / Function steps by typing { and picking them from the Secrets tab.
• Condition steps can’t read secrets; copy the value to a regular variable first if you need it for logic. Docs: https://docs.voiceflow.com

Did you find this page helpful?