0xplayerone/pi-cloudflare/cloudflare-token-scopes
Claude Code and agent skill by 0xplayerone/pi-cloudflare
- community
Checking that the SKILL.md file is still in the repository.
Add, remove, or change permission scopes on an existing Cloudflare API token. Use when a 403 names a missing permission group, when new tools need new groups, or when trimming an over-scoped token. Prefers the PUT update path (secret preserved) over delete-and-recreate.
Install
npx vskill@latest install 0xplayerone/pi-cloudflare/cloudflare-token-scopesSKILL.md
The same SKILL.md was published earlier as 0xplayerone/pi-cloudflare/cloudflare-token-scopes.
Cloudflare Token Scope Updates
Prefer updating in place: the secret survives, wiring stays intact, and the change is one auditable diff. Delete-and-recreate (or roll) is only for lost secrets and suspected exposure — see cloudflare-token-roll.
Discover the current state first
GET /api/v4/user/tokens→ find the token id by name.GET /api/v4/user/tokens/:id→ full policies (resources + groups). Never returns the secret — safe to log and diff.- A 403 from an agent tool names the missing group (
Failed common permission checkor the dashboard equivalent). That name, not guesswork, drives the change.
Resolve groups by exact name
GET /api/v4/user/tokens/permission_groups?per_page=100returns all ~400 in one page.- UI verbs map to API verbs: UI
Edit= APIWrite, UIRead= APIRead(e.g. UID1level Edit →D1 Write). - Never invent group names. If a dashboard label has no exact API match (template labels drift ahead of the API), stop and surface the candidates — do not approximate on a credential.
Update via PUT (secret preserved)
PUT /api/v4/user/tokens/:idwith the complete new{name, policies}— it replaces, so send the full intended set: keep existing groups, add or drop the target ones.- Split policies by scope exactly like creation: zone-scoped groups under
com.cloudflare.api.account.zone.*, user groups undercom.cloudflare.api.user.<id>, account groups per account (explicit ids or the account wildcard). A mixed-scope policy fails withFailed common permission check. - Same-origin
/api/v4/*in page context carries the session (persistent browser, headed for dashboard pages).Content-Type: application/jsonrequired. - Verify after: re-GET the token and diff policies, then exercise one live read per changed group. A 403 afterward means the group mapping was wrong, not the mechanism.
When you cannot self-serve: hand off with the exact spec
PUT needs a token that can manage tokens (API tokens get 9109 by design), and the dashboard path needs a headed browser plus a human for Turnstile. When neither is available, do not guess — hand the human the exact row to add:
- Derive the group from the failing call, not from memory: the tool plus
endpoint determines it (e.g. /accounts/{id}/builds/* → Workers Builds Configuration).
- Derive the level from the HTTP method: GET → Read, anything else → Edit.
- Include the scope: account-scoped groups need every managed account
included under Account Resources.
- Format it as dashboard rows so the human pastes without translating:
Account | Workers Builds Configuration | Edit, one line per row, exact labels.
When update is the wrong tool
- Secret lost or leaked → cloudflare-token-roll (no public roll route; UI flow).
- Token for a different identity or account set → create fresh (cloudflare-api-token), then delete the old one only after the new wiring verifies.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cloudflare-token-scopes/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/0xplayerone/pi-cloudflare/cloudflare-token-scopes)