@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
mdx 103 lines 4.63 KB
Raw
1 ---
2 title: cloudflare
3 description: Cloudflare provider commands — mint API tokens.
4 ---
5
6 import Terminal from "../../../components/Terminal.astro";
7
8 ```sh
9 alchemy provider cloudflare <subcommand> [options]
10 ```
11
12 Cloud-provider commands for Cloudflare. The state-store Worker that
13 backs `Cloudflare.state(...)` is managed with
14 [`alchemy state bootstrap|teardown|logs --backend cloudflare`](/cli/state#state-bootstrap).
15
16 ## `provider cloudflare token`
17
18 ```sh
19 alchemy provider cloudflare token [options]
20 ```
21
22 Mint a Cloudflare API token (`POST /user/tokens`) from the CLI. Useful
23 for creating the `CLOUDFLARE_API_TOKEN` you hand to CI, or a broad local
24 token for `alchemy deploy`. You'll be pointed to
25 [your Cloudflare profile](https://dash.cloudflare.com/profile/api-tokens)
26 once to grab your Global API Key (unless it's already in the environment);
27 everything else happens in the terminal.
28
29 This command is **standalone** — it takes no `--profile` and does not
30 use an Alchemy auth profile. Cloudflare only mints a token whose
31 permissions the authenticating credential is allowed to grant, and
32 OAuth/scoped tokens silently produce a token with **zero** permissions.
33 So this command always authenticates with your account's **Global API
34 Key**, read from `CLOUDFLARE_API_KEY` / `CLOUDFLARE_EMAIL` (or
35 prompted). The key is used only to create the token and is never stored.
36
37 By default you pick permission groups from an interactive multi-select,
38 resolved live from your account — restricted to the three scopes that
39 can actually become a token policy (account, zone, r2). Pass
40 `--all-permissions` for a "superuser" token spanning **every** permission
41 group your account exposes (after a confirmation prompt).
42
43 <Terminal content={`◇ Select a Cloudflare account
44 │ My Account
45 │
46 ◇ Token name
47 │ alchemy-superuser
48 │
49 ◇ Create a superuser token with all permissions?
50 │ Yes
51
52 Created Cloudflare API token "alchemy-superuser" (7cb070fe...).
53 Granted 360 permission group(s) across 3 policy(ies); token status: active.
54
55 cfut_pMtBzTOGHWyFC2RSNvfw8f7p2cc...
56
57 Store this value now — Cloudflare only shows it once. Use it as CLOUDFLARE_API_TOKEN.`} />
58
59 | Option | Description |
60 | ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
61 | `--all-permissions` | Grant every Cloudflare permission group (a "superuser" token). Prompts for confirmation. |
62 | `--name <name>` | Token name. Prompted (required) if omitted. |
63 | `--account-id <id>` | Account ID(s) to scope the token to — comma-separated for multiple. If omitted, you'll be prompted with a multi-select spanning your accounts. |
64 | `--env-file <path>` | Load environment variables (e.g. `CLOUDFLARE_API_KEY`, `CLOUDFLARE_EMAIL`) from a file |
65
66 The permission groups are resolved **live** from your account (so the
67 token always uses IDs valid for that account), and the freshly minted
68 token is verified against `/user/tokens/verify` before the value is
69 printed.
70
71 If the result reports `Granted 0 permission group(s)`, the token is
72 useless: a token can only carry permissions the authenticating user
73 already holds, so this usually means the Global API Key's user is not
74 a Super Administrator on the selected account. Check the user's role
75 under Members in the Cloudflare dashboard and retry.
76
77 :::note
78 The Cloudflare dashboard has a long-standing rendering bug where
79 API-created tokens show a **blank** permission summary (and a greyed-out
80 "View") on first load. The permissions are applied regardless — the
81 `Granted N permission group(s)` line and `token status: active` confirm
82 it. To see them in the UI, open the token and click "← Edit token".
83 :::
84
85 ```sh
86 # Pick permission groups interactively for a typical Alchemy deploy token
87 alchemy provider cloudflare token --name ci-token
88
89 # Full-access "superuser" token
90 alchemy provider cloudflare token --all-permissions --name admin
91
92 # Non-interactive: key/email from the environment, explicit account
93 CLOUDFLARE_API_KEY=... CLOUDFLARE_EMAIL=you@example.com \
94 alchemy provider cloudflare token --name ci --account-id <account-id>
95 ```
96
97 ## Where next
98
99 - [aws](/cli/aws) — provider commands for AWS
100 - [state](/cli/state) — bootstrap, tear down and read the state store
101 - [Inspecting State](/cli/inspecting-state) — read and manage the state store from the CLI
102 - [State Store](/state-store) — where resource state lives
103 - [Cloudflare](/cloudflare) — the Cloudflare provider hub