Skip to content
Cloudflare Docs

API token template URLs

Use template URLs to generate Cloudflare API tokens with pre-configured permissions. Template URLs allow you to share token requirements with users without manually selecting permissions in the dashboard.

Template URLs use query parameters to pre-fill the API token creation page in the Cloudflare dashboard. When a user clicks a template URL, the dashboard automatically configures the specified permissions and settings.

URL format

The basic template URL structure is:

https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=[ENCODED_PERMISSIONS]&accountId=*&zoneId=all&name=[TOKEN_NAME]

URL components

ParameterRequiredDescription
permissionGroupKeysYesURL-encoded JSON array of permission objects
accountIdYesAccount scope (use * for all accounts)
zoneIdYesZone scope (use all for all zones)
nameNoPre-filled token name

Permission format

Permissions are encoded as a JSON array with the following structure:

[{ "key": "permission_name", "type": "read|edit|revoke|run|purge" }]

Permission types

TypeDescription
readRead-only access
editFull access (create, read, update, delete)
revokeRevoke permissions
runExecute permissions
purgePurge permissions

Create custom templates

1. Identify required permissions

List the permissions your use case needs. Refer to the permission reference table.

2. Create the permission JSON

Format your permissions as a JSON array:

[
{ "key": "zone_dns", "type": "edit" },
{ "key": "analytics", "type": "read" }
]

3. URL-encode the JSON

Use a URL encoder to convert the JSON string:

%5B%7B%22key%22%3A%22zone_dns%22%2C%22type%22%3A%22edit%22%7D%2C%7B%22key%22%3A%22analytics%22%2C%22type%22%3A%22read%22%7D%5D

4. Build the complete URL

Combine all components into the final template URL:

https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=[ENCODED_JSON]&accountId=*&zoneId=all&name=Custom%20Token

Permission reference

Use this table to find permission keys for your custom templates.

Account permissions

Permission keyDescriptionCommon use cases
account_analyticsAccount analyticsReporting, monitoring
account_api_tokensAPI token managementToken automation
account_settingsAccount configurationAccount management
billingBilling informationCost tracking, invoicing
workers_scriptsWorkers scriptsServerless functions
workers_kvWorkers KV storageData storage
workers_routesWorkers routesTraffic routing

Zone permissions

Permission keyDescriptionCommon use cases
zone_dnsDNS recordsDomain management
zoneZone managementDomain configuration
analyticsZone analyticsPerformance monitoring
firewall_servicesFirewall rulesSecurity management
page_rulesPage rulesTraffic control
cache_purgeCache purgingContent updates

Access permissions

Permission keyDescriptionCommon use cases
accessAccess applicationsZero Trust apps
access_acctAccess organizationsIdentity management
access_audit_logAccess audit logsCompliance, security
access_custom_pageCustom pagesBranding, user experience

Common permission templates

Use these ready-to-use template URLs for common scenarios.

DNS management

Create tokens for DNS record management.

Use caseTemplate URL
DNS read-onlytext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22zone_dns%22%2C%22type%22%3A%22read%22%7D%5D&accountId=%2A&zoneId=all&name=DNS%20Read%20Token<br>
DNS read/writetext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22zone_dns%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=DNS%20Management%20Token<br>

Workers development

Create tokens for Workers, KV storage, and related services.

Use caseTemplate URL
Workers scripts onlytext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22workers_scripts%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=Workers%20Scripts%20Token<br>
Workers full accesstext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22workers_scripts%22%2C%22type%22%3A%22edit%22%7D%2C%7B%22key%22%3A%22workers_kv%22%2C%22type%22%3A%22edit%22%7D%2C%7B%22key%22%3A%22workers_routes%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=Workers%20Full%20Access%20Token<br>

Analytics and monitoring

Create tokens for accessing analytics and logs.

Use caseTemplate URL
Account analyticstext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22account_analytics%22%2C%22type%22%3A%22read%22%7D%5D&accountId=%2A&zoneId=all&name=Account%20Analytics%20Token<br>
Zone analyticstext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22analytics%22%2C%22type%22%3A%22read%22%7D%5D&accountId=%2A&zoneId=all&name=Zone%20Analytics%20Token<br>

Zero Trust administration

Create tokens for Cloudflare Zero Trust management.

Use caseTemplate URL
Access applications readtext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22access%22%2C%22type%22%3A%22read%22%7D%5D&accountId=%2A&zoneId=all&name=Access%20Read%20Token<br>
Access full managementtext<br>https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22access%22%2C%22type%22%3A%22edit%22%7D%2C%7B%22key%22%3A%22access_acct%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=Access%20Management%20Token<br>

Best practices

Follow these guidelines when creating and sharing template URLs.

  • Principle of least privilege: Only request the minimum permissions necessary for your use case. This reduces security risks if a token is compromised.
  • Use descriptive token names: Include clear, descriptive names in your template URLs to help users understand the token's purpose.
  • Document token usage: Provide clear documentation about what each token is used for and how to revoke it when no longer needed.
  • Regular token rotation: Encourage users to regularly rotate tokens and review permissions.
  • Test before sharing: Always test template URLs in a staging environment before sharing them with users.

Troubleshooting

Review the list of common issues and solutions.

IssueSolution
URL does not pre-fill permissionsVerify the JSON is properly URL-encoded
Permissions are missingCheck permission keys in the reference table
Token name does not appearEnsure the name parameter is URL-encoded
Access denied errorVerify the user has required permissions in their account

Additionally, review the checklist before sharing a template URL.

  • All permission keys are correct
  • JSON syntax is valid
  • URL encoding is proper
  • Token name is descriptive
  • Permissions follow least privilege principle