Workers - New Workers bulk secrets API endpoint
Key Points
- Bulk create/update/delete secrets in one request
- Set a secret to null to delete it
- CLI: npx wrangler secret bulk <secrets.json>
Summary
Cloudflare Workers now supports a bulk secrets API that lets you create, update, or delete multiple secrets for a Worker in a single request. Provide a secret object with a value to create or update it; set a secret to null to delete it. Secrets not included in the request remain unchanged.
Key Points
- Endpoint accepts a JSON payload mapping secret names to objects (create/update) or
null(delete). - Use the CLI:
npx wrangler secret bulk <secrets.json>to apply the same JSON file from the command line. - Deletion is performed by setting a secret value to
null; deletions are not supported with.envfiles. - Each bulk request supports up to 100 operations total (creates + updates + deletes).
- Typical workflow: include new or updated secrets with their values, set unwanted keys to
null, and omit keys to leave them unchanged.
Practical notes for engineers
- Validate your JSON before sending; malformed payloads can fail the whole request.
- Keep payloads under 100 operations per request; batch larger sets.
- Store the JSON file securely (contains secret values) and avoid committing it to version control.