secrets
how do i use secret variable in the conditional step and also in the api body request?
1 Reply
Here’s how to reference a secret in both places:
1. Create the secret
• Agent Settings → Secrets → New Secret → save.
2. Use it in a Condition step
Business Logic ➜ either method works
• Condition Builder: click the Variable field → type “{” → switch to the Secrets tab → pick the secret. Finish the comparison as usual.
• Expression: write an expression and insert the secret the same way, e.g.
{MY_SECRET} === "gold"
(The secret token is resolved at run-time; the value never appears on the canvas.)
3. Use it in an API step (or Function)
In any Endpoint, Header, Param or Raw Body field:
• type “{” → Secrets tab → pick the secret.
• If you’re writing raw JSON keep the placeholder inside quotes, e.g.
{
"api_key": "{OPENAI_KEY}",
"query": "{user_query}"
}
That’s it—at runtime Voiceflow replaces the placeholder with the actual secret value, so your key stays hidden while your logic and API call work normally.
Docs: https://docs.voiceflow.com → Secrets Manager, Condition step, API step sections.