Cloudflare API TypeScript client: cloudflare-api-js
v4.19.0Unofficial, fully typed TypeScript client for the Cloudflare API, generated from its OpenAPI spec and published to npm as cloudflare-api-js.
Not affiliated with or endorsed by Cloudflare.
Installation
npm install cloudflare-api-jsAuthentication
Pass an API token as the token option, or, for operations that accept only the legacy Global API Key, pass apiKey with the email of its account.
Examples
import { CloudflareApi } from "cloudflare-api-js";
const client = new CloudflareApi({ token: process.env.CLOUDFLARE_TOKEN ?? "" });
const accounts = await client.api.accounts.accountsListAccounts({});const accounts = await client.request("GET /accounts");const client = new CloudflareApi({
apiKey: process.env.CLOUDFLARE_API_KEY ?? "",
email: process.env.CLOUDFLARE_EMAIL ?? "",
});