process.env.
Add a secret
Usentn workers env set to store one or more secrets for your worker:
KEY=value pairs:
Use a secret in worker code
Read secrets fromprocess.env inside your worker capability:
Pull secrets for local development
When you run a worker locally, use a.env file to provide the same environment variables that the hosted worker receives.
Pull remote secrets into .env:
pull preserves comments, blank lines, and local-only keys. It updates keys that also exist remotely, then appends new remote keys.
For non-interactive scripts, add --yes to skip the confirmation prompt:
Push local secrets to your worker
If you’ve added secrets locally to.env, push them to the hosted worker:
push adds new local keys and updates changed local keys. It does not remove keys that exist only in the remote worker environment.
For non-interactive scripts, add --yes:
Manage another worker
When you run these commands inside a worker project, the CLI reads the worker ID fromworkers.json. To manage a different worker, pass its worker ID.
For set and unset, use --worker-id:
list, pull, and push, pass the worker ID as the positional argument:
Use secrets for OAuth client credentials
For custom OAuth providers, store the OAuth client ID and client secret as worker secrets:process.env in the OAuth capability configuration:
Command summary
See the CLI command reference for all
ntn workers env flags and options.
Next steps
OAuth
Authenticate with third-party APIs using OAuth.
Syncs
Sync external data into Notion databases.
Agent tools
Build custom tools for Notion AI.
Webhooks
Receive HTTP events from external services.