Skip to content

Account

Source: src/Cloudflare/Account/Account.ts

A Cloudflare account (subaccount), for tenant / partner platforms that provision an account per customer.

Creating accounts (POST /accounts) is restricted to credentials with the tenant entitlement — a standard user receives the typed AccountCreationForbidden error (Cloudflare error code 1002). The name and account settings are mutable in place; type and the tenant unit are create-only and trigger a replacement. Deleting the resource queues the account for deletion (also tenant-gated).

The account’s physical identity is the Cloudflare-assigned accountId. Account names are not unique, so there is no find-by-name fallback: if state is lost, the account is treated as missing rather than guessed at.

Standard subaccount with a generated name

const account = yield* Cloudflare.Account.Account("CustomerAccount", {});

Subaccount on a specific tenant unit

const account = yield* Cloudflare.Account.Account("CustomerAccount", {
name: "Customer: ACME Inc",
unit: { id: tenantUnitId },
});
const account = yield* Cloudflare.Account.Account("CustomerAccount", {
name: "Customer: ACME Inc",
enforceTwofactor: true,
abuseContactEmail: "abuse@acme.example",
});