All skills
Skillintermediate

Cloudflare API Integration

Guide for working with Cloudflare's REST API - authentication, SDK usage, common patterns, and troubleshooting.

Claude Code Knowledge Pack7/10/2026

Overview

Cloudflare API Integration

Guide for working with Cloudflare's REST API - authentication, SDK usage, common patterns, and troubleshooting.

Quick Decision Tree

How are you calling the Cloudflare API?
├─ From Workers runtime → Use bindings, not REST API (see ../bindings/)
├─ Server-side (Node/Python/Go) → Official SDK (see api.md)
├─ CLI/scripts → Wrangler or curl (see configuration.md)
├─ Infrastructure-as-code → See ../pulumi/ or ../terraform/
└─ One-off requests → curl examples (see api.md)

SDK Selection

LanguagePackageBest ForDefault Retries
TypeScriptcloudflareNode.js, Bun, Next.js, Workers2
PythoncloudflareFastAPI, Django, scripts2
Gocloudflare-go/v4CLI tools, microservices10

All SDKs are Stainless-generated from OpenAPI spec (consistent APIs).

Authentication Methods

MethodSecurityUse CaseScope
API TokenScoped, rotatableProductionPer-zone or account
API Key + EmailFull account accessLegacy onlyEverything
User Service KeyLimitedOrigin CA certs onlyOrigin CA

Always use API tokens for new projects.

Rate Limits

LimitValue
Per user/token1200 requests / 5 minutes
Per IP200 requests / second
GraphQL320 / 5 minutes (cost-based)

Reading Order

TaskFiles to Read
Initialize SDK clientapi.md
Configure auth/timeout/retryconfiguration.md
Find usage patternspatterns.md
Debug errors/rate limitsgotchas.md
Product-specific APIs../workers/, ../r2/, ../kv/, etc.

In This Reference

  • api.md - SDK client initialization, pagination, error handling, examples
  • configuration.md - Environment variables, SDK config, Wrangler setup
  • patterns.md - Real-world patterns, batch operations, workflows
  • gotchas.md - Rate limits, SDK-specific issues, troubleshooting

See Also