How to
Last updated Apr 16, 2026 Refer to the sections below to learn about common actions you might want to take when managing your data in Secrets Store.
You must have a Super Administrator or Secrets Store Admin role within your Cloudflare account.
Manage via Wrangler
Wrangler is a command-line interface (CLI) that allows you to manage Cloudflare Workers projects. Refer to Wrangler commands for guidance on how to use it with Secrets Store.
Create a secret
- In the Cloudflare dashboard, go to the Secrets Store page. Go to Secrets Store ↗
- Select Create secret.
- Fill in the required fields. Note that, once the secret is saved, the secret value will no longer be available for viewing.
- (Optional) Select Add additional secret to create more than one secret at a time.
- Select Save to confirm.
Note
A secret name cannot contain spaces. Refer to Secrets Store API for the full API documentation.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Secrets Store Write</code>
</details>
Create a secretbash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets" \
--request POST \
--header "X-Auth-Email: $CLOUDFLARE_EMAIL" \
--header "X-Auth-Key: $CLOUDFLARE_API_KEY" \
--json '[
{
"name": "<MY_SECRET_NAME>",
"value": "<SECRET_VALUE>",
"scopes": [
"workers"
],
"comment": ""
},
{
"name": "<MY_SECRET_NAME_2>",
"value": "<SECRET_VALUE>",
"scopes": [
"workers"
],
"comment": ""
}
]'
Duplicate a secret
Duplicate a secret to keep the same secret value but change name, scope, or comments.
- In the Cloudflare dashboard, go to the Secrets Store page. Go to Secrets Store ↗
- Search for the secret you would like to duplicate within the existing secrets list.
- Select the three dots next to the secret and choose Duplicate.
- Edit the Secret name, Permission scope, or Comment, according to your needs.
- Select Save to confirm.
Note
A secret name cannot contain spaces. Refer to Secrets Store API for the full API documentation.
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets/$SECRET_ID/duplicate \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"name":"<NEW_DUPLICATE_NAME>",
"scopes":["workers"],
"comment":""
}'
Edit a secret
Edit a secret to replace an existing value with a new one.
Caution
This action will cause the replacement in all services using the secret.
You can also edit the secret Permission scope and Comment.
- In the Cloudflare dashboard, go to the Secrets Store page. Go to Secrets Store ↗
- Search for the secret you would like to edit within the existing secrets list.
- Select the three dots next to the secret and choose Edit.
- Edit the available fields according to your needs and select Save to confirm.
Refer to Secrets Store API for the full API documentation.
curl --request PATCH \
https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets/$SECRET_ID \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"comment":"<NEW_COMMENT>",
"value":"<NEW_SECRET_VALUE>",
"scopes":["workers"]
}'
Delete a secret
Caution
Before deleting a secret, make sure it is not deployed in your Workers applications ↗︎ or AI gateways ↗︎.
- In the Cloudflare dashboard, go to the Secrets Store page. Go to Secrets Store ↗
- Search for the secret you would like to delete within the existing secrets list.
- Select the three dots next to the secret and choose Delete.
- Type in the secret name and select Delete to confirm.
Refer to Secrets Store API for the full API documentation.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Secrets Store Write</code>
</details>
Delete a secretbash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets/$SECRET_ID" \
--request DELETE \
--header "X-Auth-Email: $CLOUDFLARE_EMAIL" \
--header "X-Auth-Key: $CLOUDFLARE_API_KEY"
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/secrets-store/manage-secrets/how-to/#page","headline":"How to","description":"Create, update, duplicate, and delete secrets using the dashboard, API, or Wrangler.","url":"https://developers.cloudflare.com/secrets-store/manage-secrets/how-to/","inLanguage":"en","image":"https://developers.cloudflare.com/secrets-store/manage-secrets/how-to/og.png?v=3aba431a8a421018","dateModified":"2026-04-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Securely store AI provider API keys in AI Gateway and reference them in your gateway configuration. title: BYOK (Store Keys) image: https://developers.cloudflare.com/ai-gateway/configuration/bring-your-own-keys/og.png?v=98c98db081b860ba
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ai-gateway/llms.txt
Use this file to discover all available pages before exploring further.
Docs