Keys / Cloudflare
CLOUDFLARE_API_TOKEN
The Cloudflare API token your app, Wrangler or CI calls the Cloudflare API with.
- Expires
- you choose, or never
- API
- create, list, roll and delete, with a token that can edit API tokens
Get it
Create one on dash.cloudflare.com/profile/api-tokens. The steps aren't recorded yet.
Set it
CLOUDFLARE_API_TOKEN=...
The TypeScript, Python and Go SDKs read it when you don't pass a token, and Wrangler reads it in CI and other automation. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Create a new token with the same permissions, IP filters and expiration.
keypin rotaterefuses a Global API Key or a Wrangler login; it replaces API tokens only. - Deploy it everywhere that reads
CLOUDFLARE_API_TOKEN. - Check that nothing still uses the old token, then delete it.
- Or select Roll in the old token's menu: the new one keeps its permissions, but the old one stops working at once.
Sources, checked 2026-11-16
- Cloudflare: Create API token
- Cloudflare: Roll tokens
- Cloudflare: Token formats
- Cloudflare: Create tokens via API
- Cloudflare API: User tokens
- Wrangler: System environment variables
- cloudflare-typescript: reads CLOUDFLARE_API_TOKEN
- cloudflare-python: reads CLOUDFLARE_API_TOKEN
- cloudflare-go: reads CLOUDFLARE_API_TOKEN