npx wrangler secret put API_KEY

Category: Cloudflare

npx wrangler secret put API_KEY

Create or update a Worker secret

Prompts for a value and stores it as an encrypted secret bound to your Worker's runtime, so code reads it from the environment without the value ever appearing in source or the dashboard. Each put creates a new version and deploys it immediately. Secrets are the right home for API keys and tokens.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.