Use a template or create a custom token with the permissions you need
Copy your token and store it securely
Keep your API token secure! Never commit it to version control or share it publicly.
3
Set up environment variables
Store your API token in an environment variable:
CLOUDFLARE_API_TOKEN=your_api_token_here
4
Make your first API call
Create a new TypeScript or JavaScript file and import the SDK:
import Cloudflare from 'cloudflare';const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'],});// List all accountsasync function listAccounts() { const accounts = await client.accounts.list(); console.log('Your accounts:'); for await (const account of accounts) { console.log(`- ${account.name} (${account.id})`); }}listAccounts();