OpenAICloudflare Developer PlatformJun 3, 2026, 12:00 AM

Workers - New Workers bulk secrets API endpoint

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

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 .env files.
  • 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.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Workers - 新しい Workers bulk secrets API エンドポイント

新しい Workers bulk secrets API エンドポイント

Cloudflare の更新: Worker の複数シークレットを単一リクエストで作成、更新、削除できる bulk secrets エンドポイントが利用可能になりました。

  • シークレットを作成または更新するには、値を含めて送信します。
  • シークレットを削除するには、その値を null に設定します。
  • リクエストに含まれていないシークレットは変更されません。

以下の例は API_KEY を作成し、既存の DB_PASSWORD を更新し、OLD_SECRET を削除します:

{
  "secrets": {
    "API_KEY": {
      "type": "secret_text",
      "name": "API_KEY",
      "text": "my-api-key"
    },
    "DB_PASSWORD": {
      "type": "secret_text",
      "name": "DB_PASSWORD",
      "text": "my-db-password"
    },
    "OLD_SECRET": null
  }
}

コマンドラインからは wrangler を使って同じ操作ができます:

npx wrangler secret bulk < secrets.json

注意事項:

  • キーを削除するには JSON ファイルで値を null に設定してください。
  • 削除は .env ファイルではサポートされていません。
  • 各リクエストは最大 100 件の操作(作成、更新、削除の合計)をサポートします。

関連リソース:

  • Resources API