API token template URLs
Last updated Sep 21, 2026 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 opens a template URL, the dashboard automatically configures the specified permissions and settings.
Cloudflare supports template URLs for both user API tokens and account API tokens. For more information on the difference between these token types, refer to Account API tokens.
Note
Template URLs only pre-fill the token creation form. Users must still complete the token creation process in the dashboard.
User token URL format
User token template URLs open the token creation form at the user profile level (/profile/api-tokens). Tokens created this way are owned by the user.
The basic template URL structure is:
https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=[ENCODED_PERMISSIONS]&accountId=*&zoneId=all&name=[TOKEN_NAME]
URL components
| Parameter | Required | Description |
|---|---|---|
permissionGroupKeys |
Yes | URL-encoded JSON array of permission objects |
accountId |
Yes | Account scope (use * for all accounts) |
zoneId |
Yes | Zone scope (use all for all zones) |
name |
No | Pre-filled token name |
Account token URL format
Account token template URLs open the token creation form at the account level. Tokens created this way are owned by the account (service principal tokens) and are not tied to any individual user. Refer to Account API tokens for role and permission requirements.
The basic template URL structure is:
https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=[ENCODED_PERMISSIONS]&name=[TOKEN_NAME]
The :account segment is a placeholder. When a user opens the URL, the dashboard prompts them to select an account if they have access to more than one.
URL components
| Parameter | Required | Description |
|---|---|---|
permissionGroupKeys |
Yes | URL-encoded JSON array of permission objects |
name |
No | Pre-filled token name |
Note
Account token template URLs do not use accountId or zoneId parameters. Resource scoping for account tokens is configured during token creation in the dashboard.
Permission format
Both user token and account token template URLs use the same permission encoding: a JSON array with the following structure.
[{ "key": "permission_name", "type": "read|edit|revoke|run|purge" }]
The two token types resolve these entries differently, as described in the following sections.
For account token URLs, each key can be either a short permission key (for example, dns) or a permission group ID. Using the permission group ID is the most reliable option, since it maps to exactly one group. Refer to Use permission group IDs.
For user token URLs, each key must be a short permission key that matches a group name exactly, and the type must be edit (not write), read, revoke, run, or purge. Permission group IDs are not supported, and any entry that does not match is dropped silently.
Permission types
| Type | Description |
|---|---|
read |
Read-only access |
edit |
Full access (create, read, update, delete) |
revoke |
Revoke permissions |
run |
Execute permissions |
purge |
Purge permissions |
Use permission group IDs
Note
Permission group IDs are supported in account token URLs only. User token URLs must use short keys.
To address any permission group in an account token URL, including groups that do not have a short key in the permission reference, use its permission group ID as the key:
[{ "key": "82e64a83756745bbbb1c9c2701bf816b", "type": "edit" }]
Permission group IDs are the stable, canonical identifier for a permission group. They are the same IDs accepted by the Create token endpoint and the Cloudflare Terraform provider, so a template URL can pre-select any permission group by ID. Because the ID names one specific group, the type field is ignored when you pass an ID.
Combine multiple IDs in the same array, just as you would with short keys:
[
{ "key": "e086da7e2179491d91ee5f35b3ca210a", "type": "edit" },
{ "key": "7cf72faf220841aabcfdfab81c43c4f6", "type": "read" }
]
Because account token URLs create account-owned tokens, look up their permission group IDs with the account-scoped List permission groups endpoint. The request needs a token with the API Tokens Read account permission:
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/tokens/permission_groups" \
--header "Authorization: Bearer <API_TOKEN>"
For user tokens, use the user-scoped endpoint instead, which returns the permission groups available to user tokens:
curl "https://api.cloudflare.com/client/v4/user/tokens/permission_groups" \
--header "Authorization: Bearer <API_TOKEN>"
Each result includes the permission group id and name. The API token permissions reference also lists these IDs.
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": "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%22dns%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
For a user token, combine all components into the final template URL:
https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=[ENCODED_JSON]&accountId=*&zoneId=all&name=Custom%20Token
For an account token, use the account-level path instead:
https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=[ENCODED_JSON]&name=Custom%20Token
Permission reference
Use this table to find permission keys for your custom templates.
Account permissions
| Permission key | Description | Common use cases |
|---|---|---|
account_analytics |
Account analytics | Reporting, monitoring |
account_api_tokens |
API token management | Token automation |
account_settings |
Account configuration | Account management |
billing |
Billing information | Cost tracking, invoicing |
workers_scripts |
Workers scripts | Serverless functions |
workers_kv_storage |
Workers KV storage | Data storage |
workers_routes |
Workers routes | Traffic routing |
workers_r2 |
R2 storage | Object storage |
d1 |
D1 database | SQL databases |
queues |
Queues | Message queuing |
page |
Cloudflare Pages | Page deployments |
stream |
Stream | Video streaming |
images |
Images | Image optimization |
account_logs |
Logs | Log management |
Zone permissions
| Permission key | Description | Common use cases |
|---|---|---|
dns |
DNS records | Domain management |
zone |
Zone management | Domain configuration |
zone_settings |
Zone settings | Zone configuration |
analytics |
Zone analytics | Performance monitoring |
firewall_services |
Firewall rules | Security management |
page_rules |
Page rules | Traffic control |
cache |
Cache purging | Content updates |
ssl_and_certificates |
SSL/TLS certificates | Certificate management |
logs |
Logs | Log management |
Access permissions
| Permission key | Description | Common use cases |
|---|---|---|
access |
Access applications | Zero Trust apps |
access_acct |
Access organizations | Identity management |
access_audit_log |
Access audit logs | Compliance, security |
access_custom_page |
Custom pages | Branding, user experience |
teams |
Zero Trust | Gateway, CASB, DLP |
Common permission templates
Use these ready-to-use template URLs for common scenarios. Each example provides both a user token URL and an account token URL.
DNS management
Create tokens for DNS record management.
User token
| Use case | Template URL |
|---|---|
| DNS read-only | https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22read%22%7D%5D&accountId=%2A&zoneId=all&name=DNS%20Read%20Token |
| DNS read/write | https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22edit%22%7D%5D&accountId=%2A&zoneId=all&name=DNS%20Management%20Token |
Account token
| Use case | Template URL |
|---|---|
| DNS read-only | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22read%22%7D%5D&name=DNS%20Read%20Token |
| DNS read/write | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22dns%22%2C%22type%22%3A%22edit%22%7D%5D&name=DNS%20Management%20Token |
Workers development
Create tokens for Workers, KV storage, and related services.
User token
| Use case | Template URL |
|---|---|
| Workers scripts only | 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 |
| Workers full access | 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_storage%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 |
Account token
| Use case | Template URL |
|---|---|
| Workers scripts only | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22workers_scripts%22%2C%22type%22%3A%22edit%22%7D%5D&name=Workers%20Scripts%20Token |
| Workers full access | https://dash.cloudflare.com/?to=/:account/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_storage%22%2C%22type%22%3A%22edit%22%7D%2C%7B%22key%22%3A%22workers_routes%22%2C%22type%22%3A%22edit%22%7D%5D&name=Workers%20Full%20Access%20Token |
Analytics and monitoring
Create tokens for accessing analytics and logs.
User token
| Use case | Template URL |
|---|---|
| Account analytics | 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 |
| Zone analytics | 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 |
Account token
| Use case | Template URL |
|---|---|
| Account analytics | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22account_analytics%22%2C%22type%22%3A%22read%22%7D%5D&name=Account%20Analytics%20Token |
| Zone analytics | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22analytics%22%2C%22type%22%3A%22read%22%7D%5D&name=Zone%20Analytics%20Token |
Zero Trust administration
Create tokens for Cloudflare Zero Trust management.
User token
| Use case | Template URL |
|---|---|
| Access applications read | 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 |
| Access full management | 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 |
Account token
| Use case | Template URL |
|---|---|
| Access applications read | https://dash.cloudflare.com/?to=/:account/api-tokens&permissionGroupKeys=%5B%7B%22key%22%3A%22access%22%2C%22type%22%3A%22read%22%7D%5D&name=Access%20Read%20Token |
| Access full management | https://dash.cloudflare.com/?to=/:account/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&name=Access%20Management%20Token |
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.
| Issue | Solution |
|---|---|
| URL does not pre-fill permissions | Verify the JSON is properly URL-encoded |
| Permissions are missing | Check permission keys against the reference table, or address the group by its permission group ID |
| Token name does not appear | Ensure the name parameter is URL-encoded |
| Access denied error | Verify the user has required permissions in their account |
For account token URLs, when a template URL contains a key that cannot be resolved, or the permissionGroupKeys value is not valid JSON, the dashboard still opens the token creation form with whatever it could resolve and shows a notice naming the keys it could not apply. It does not redirect back to the token list, so a mistyped key surfaces in the form instead of failing silently.
For user token URLs, unresolved entries are dropped silently and no notice is shown, so verify each key against the permission reference before sharing the URL.
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
Related resources
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/fundamentals/api/how-to/account-owned-token-template/#page","headline":"API token template URLs","description":"Generate Cloudflare API tokens with pre-configured permissions using template URLs. Learn how to create and customize template URLs for any use case.","url":"https://developers.cloudflare.com/fundamentals/api/how-to/account-owned-token-template/","inLanguage":"en","image":"https://developers.cloudflare.com/fundamentals/api/how-to/account-owned-token-template/og.png?v=23273125a22cf721","dateModified":"2026-09-21","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: Restrict Cloudflare API access at the account or member level using Enterprise account controls. title: Control API Access image: https://developers.cloudflare.com/fundamentals/api/how-to/control-api-access/og.png?v=b23fece225210429
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/fundamentals/llms.txt
Use this file to discover all available pages before exploring further.
Docs