Skip to content
GitHubXDiscord

AccountId

The AccountId resource retrieves a Cloudflare Account ID for use with other Cloudflare resources.

Get the account ID from environment variables or API token:

import { AccountId } from "alchemy/cloudflare";
const accountId = await AccountId("my-account");

Provide an API key and email directly:

import { AccountId } from "alchemy/cloudflare";
const accountId = await AccountId("my-account", {
apiKey: alchemy.secret(process.env.CF_API_KEY),
email: "user@example.com",
});

Use the account ID with a Worker:

import { Worker, AccountId } from "alchemy/cloudflare";
const accountId = await AccountId("my-account");
await Worker("my-worker", {
name: "my-worker",
script: "console.log('Hello, world!')",
accountId: accountId,
});