Constants and secrets
Store named values, such as API keys and configuration, and use them across notebooks.
A constant is a named value you store once and use across notebooks, such as a data provider's API key, a configuration setting or a risk threshold. Any constant can be marked as a secret, which hides its value.
Find them under Assets → Constants.
Constants and secrets
Value visible to people with access
Yes
No, it's hidden in the interface
Available to code when a block runs
Yes
Yes
Typical use
Configuration, thresholds, IDs
API keys, passwords, tokens
You can turn a constant into a secret, or a secret back into a constant, at any time.
Every value is stored in a secure vault, including ordinary constants, not just secrets. That's why any constant can become a secret later without moving its value.
Creating a constant
Go to Assets → Constants and create a new constant. Give it a name, a value and a description, and choose whether it's a secret.
Versions
Constants are versioned. Each time you change a constant, you create a new version (v1, v2 and so on), with its own value, description and secret setting.
Notebooks use a specific version
When you attach a constant to a notebook, the notebook uses a specific version. Creating a new version doesn't change notebooks that use an older one. Switch each notebook to the new version when you're ready.
This means you can roll out a change safely. For example, when you rotate a data provider's API key:
Create a new version of the constant with the new key.
Switch one notebook to the new version and check it works.
Switch the rest of your notebooks.
When you attach a constant, you can also give it an alias: a different name to use in that notebook.
Sharing
Constants follow the same sharing rules as other assets, and each version can be shared separately. See Sharing and privacy.
Secrets and agents
Agents never ask you to type a secret into a conversation. When a superagent needs a credential, you enter it in a secure form and it's stored as a secret. See Decisions and recommendations.
Last updated
Was this helpful?
