${NAME}, and Cadenya swaps in the real value when it calls the tool. The value never comes back out through the API.
In this lesson you store an API token as a workspace secret and wire it into a tool set.
What you need
- A workspace, with your API key in
CADENYA_API_KEYand your workspace ID inWORKSPACE_ID. - A credential to store, such as a third-party API token.
Step 1: Store the secret
In the sidebar, open Secrets and create one. Give it a Name and a Value. Cadenya uppercases the name and turns spaces and hyphens into underscores to form the reference, sostripe_api_key becomes ${STRIPE_API_KEY} and billing-key becomes ${BILLING_KEY}. Stick to letters, digits, and underscores so the reference reads exactly like the name you typed.
The Create secret form with a name and a value
Step 2: Reference it in a tool header
A workspace secret is reachable by any tool set in the workspace. Put the reference in the adapter’s headers, where the provider expects the credential:${STRIPE_API_KEY} text in the configuration. The substitution happens later, at the moment of the call. The same ${NAME} reference works in MCP and OpenAPI adapter headers, not only HTTP.
Step 3: Watch it resolve at call time
Assign the tool set to an agent and run an objective that calls one of its tools. When the agent fires the call, Cadenya resolves${STRIPE_API_KEY} against your secrets and sends the real token in the header. The objective’s events show the tool call, but never the secret value.
Cadenya catches a missing secret when you connect the tool set, not in production. Sync an MCP or OpenAPI tool set whose header references a name that does not exist and the sync fails with an unresolved_secrets error that names the missing ${NAME}, so a typo surfaces at setup.
Rotate a secret
Rotate by updating the value and keeping the name. Every${NAME} reference picks up the new value on the next call, so nothing else changes. Pass the secret id from the create response.
Per-run secrets
A workspace secret is shared across the workspace, which suits a long-lived service token. For a credential scoped to one run, such as a single customer’s short-lived token, pass an objective secret when you start the objective. An objective secret overrides a secret of the same name at any wider scope, so the same${NAME} reference resolves to the per-run value.
There are three scopes, and the narrowest wins: an objective secret, then a tool set secret, then a workspace secret. To see which one a tool call used, read the call by ID and check resolvedSecrets, which names the key and its source without ever revealing the value.
What you built
You stored a credential once, referenced it by name in a tool header, and let Cadenya inject it at call time without ever exposing it. Add more secrets and reference each one the same way.Going further
How secrets work
Encryption, interpolation, and how workspace and objective secrets layer.
Connect a tool set
The adapters whose headers carry your secret references.