Storing Secrets and Environment Variables
Bind workspace secrets by name. Containers/pods, functions, endpoints, task queues, and image builds receive real values as plaintext environment variables. These workloads do not require credential hosts; adding hosts does not enable proxying for them. Only VM and sandbox runtime bindings use brokered placeholders, with the explicit token exceptions below. To create a secret in the dashboard, go to Settings → Secrets, click Create secret, and enter a name and value. You can update or delete secrets from the same page. You can also manage secrets through the CLI:Using Secrets
Serverless functions and endpoints access the real value through an environment variable:beam deploy or the dashboard, use environment references such as ${{secret.AWS_ACCESS_KEY}}.
Passing Secrets to on_start
If your app used an on_start function, secrets can be passed to that function as well.
Brokered secrets for VMs and sandboxes
Give a runtime secret the hostnames that may receive it, then bind it by name:secrets=["OPENAI_API_KEY"]. For example:
beam_secret_... placeholder. Use it directly in an HTTPS request header:
Authorization or x-api-key headers need no auth changes; streaming responses are supported. On other hosts, the placeholder is never exchanged for the key.
Repeat --host for multiple hostnames, up to 64 rules. *.example.com matches subdomains, excluding example.com itself. Credential host rules cannot contain schemes, ports, paths, IPs, or CIDRs. Existing secrets need host rules before binding to a VM or sandbox; add them with beam secret update NAME VALUE --host HOST.
Brokered secret values must contain 1–16384 bytes.
Credential hosts and outbound access
Credential host rules control where a key can be substituted. Network rules control what the guest can reach:
The same settings apply to sandbox networking. Both creation and per-exec bindings require hosts covered by the guest’s explicit allowlist, when present. IP/CIDR entries alone do not cover credential hostnames. Proxied private, loopback, and link-local destinations remain blocked even with an explicit IP/CIDR rule.
Rotation and compatibility
--host preserves host rules; supplying it replaces them.
- Substitution is literal and header-only. Query/body credentials, local signing, hashing, and encoding the placeholder are unsupported. For Basic auth, store the base64 credential and send
Authorization: Basic $SECRET; do not encode the placeholder. - Brokering supports HTTPS on port 443; plain HTTP to a credential-bound host is blocked. Certificate-pinned clients cannot use this TLS interception. The guest receives trusted CA certificates automatically; Docker containers need explicit CA configuration.
- Brokered WebSocket messages are limited to 16 MiB. Compressed upstream responses are rejected when they cannot be scrubbed.
- Serverless and image-build secrets retain their existing plaintext behavior. Workspace callers with permission can still retrieve values using
beam secret showor secret-management APIs.
BETA9_TOKEN or BEAM_TOKEN secret. These token bindings are plaintext opt-ins and do not require credential host rules.
Self-hosted deployments, including agent-managed workers, must upgrade worker images before using hostname allowlists or brokered secrets.
MCP tools
create_secret and update_secret accept name, value, and optional hosts, for example {"name":"OPENAI_API_KEY","value":"<real-key>","hosts":["api.openai.com"]}. On update, omit hosts to preserve the current list, supply a list to replace it, or pass [] to clear it. list_secrets returns hosts and placeholders without values. Bind VM runtime secrets under create_vm.spec.secrets or vm_exec.secrets.
CLI Commands
List Secrets
beam secret list --format json for structured output.
Create a Secret
Show a Secret
Update a Secret
modify is an alias of update. Omit --host to preserve host rules, repeat it to replace them, or use --clear-hosts to remove them. A secret without hosts cannot be bound as a brokered runtime secret. Serverless containers pick up a changed value on their next start; brokered requests use the 15-second refresh described above.