Skip to content

Find Cloudflare Account ID

You can retrieve your Account ID either through the Cloudflare dashboard or via the Wrangler CLI.

Option 1: Via the Dashboard

  1. Log in to the Cloudflare Dashboard.
  2. Navigate to Workers & Pages in the left sidebar.
  3. Look at the right sidebar under Account Details to find and copy your Account ID (a 32-character hexadecimal string).
  4. Alternatively, select any registered domain or zone; the Account ID appears on the right sidebar under the API section.

Option 2: Via the Wrangler CLI

If you have already authenticated Wrangler via your browser, run:

npx wrangler whoami
This command displays your logged-in account name, email, and associated Account ID in the terminal.

Create Scoped API Token

Creating a scoped API token follows the principle of least privilege.

Step-by-Step Instructions

  1. In the Cloudflare Dashboard, click your User Profile icon (top-right corner) and select My Profile.
  2. Select API Tokens from the left navigation menu, then click Create Token.
  3. Under Custom Token, click Get started.
  4. Configure the token details:
  5. Token name: e.g., Wrangler Pages Deployment.
  6. Permissions: Select Account → Cloudflare Pages → Edit.
  7. (Optional) If your project uses Pages Functions with Workers KV, D1, or R2, add Workers KV Storage → Edit or D1 → Edit.
  8. Account Resources: Choose Include → Specific account → select your account.
  9. Click Continue to summary, review the permissions, and click Create Token.
  10. Copy and store the generated token immediately, as Cloudflare will not display it again.