env.NAME. They never reach the browser.
Prerequisites
- Full editor access to the website (the
websiteSecrets.managecapability).
Add a secret
1
Open the website's settings
In the studio, open Settings and find Secrets.
2
Add the secret
Choose Add secret, enter the name the function reads (letters, numbers, and underscores, such as
CRM_API_KEY), paste the value, and save. Values can be up to 16,384 characters.3
Use it in a function
Read it as
env.CRM_API_KEY. Drafts and the live site use the same value, so you can test on the draft before publishing.How secrets are kept
- Values are encrypted at rest and can’t be viewed after saving, through the dashboard, the API, or MCP. To change one, replace it.
- Each name has one value, shared by drafts and the published site.
- Secrets move with a transferred website and are destroyed when the website is permanently deleted.
- A website holds up to 100 secrets.
API
GET /v1/websites/{websiteId}/secretslists names and when each was last updated, never values.PUT /v1/websites/{websiteId}/secrets/{name}with{ "value": "..." }adds or replaces a secret.DELETE /v1/websites/{websiteId}/secrets/{name}removes one; functions then readundefined.