Cloudflare
Manage DNS, CDN, Workers and other services; documented with an official OpenAPI 3.0 spec
- Authentication
- API Key
- HTTPS
- Yes
- CORS
- No
- Category
- Development
- Documentation / URL
- https://developers.cloudflare.com/api/
Overview
The Cloudflare API manages everything on Cloudflare — DNS zones, CDN/cache, Workers, Pages, KV, Durable Objects, R2 storage, WAF rules, analytics, and more. Auth is a Global API Key or (preferred) API Tokens — there’s no anonymous access.
Quick Start
An API token is required (create at dash.cloudflare.com/profile/api-tokens):
# List zones:
curl "https://api.cloudflare.com/client/v4/zones" \
-H "Authorization: Bearer YOUR_TOKEN"
Create a DNS record:
curl -X POST "https://api.cloudflare.com/client/v4/zones/ZONE_ID/dns_records" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"type": "A", "name": "example.com", "content": "192.0.2.1", "ttl": 3600}'
Purge cache:
curl -X POST "https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"purge_everything": true}'
Authentication
- API Tokens (preferred): create scoped tokens (e.g. “Zone.DNS:Edit”) at dash.cloudflare.com/profile/api-tokens.
- Global API Key (legacy): account-level, powerful — prefer tokens.
- Send as
Authorization: Bearer TOKEN(orX-Auth-Email+X-Auth-Keyfor the global key).
Rate Limits & Notes
- All responses are wrapped in
{"success": true, "result": ...}— checksuccessanderrors[]. - Rate limits are per-endpoint (documented); Workers/Pages have their own limits.
- The API is versioned (
/client/v4/); account-scoped calls use/accounts/{account_id}/. - GraphQL analytics API available at
/graphql.
FAQ
Is Cloudflare API free? Yes — the API is free; costs come from paid plan features you use.
Token or global key? Prefer scoped API tokens; the global key is a legacy all-powerful credential.
How do I find my zone ID?
In the dashboard’s domain overview, or via GET /zones with your token.
More in Development
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| 24 Pull Requests Project to promote open source collaboration during December | No auth | Yes | Yes | ↗ |
| Agify.io Estimates the age from a first name | No auth | Yes | Yes | ↗ |
| Amazonscraperapi Amazon product, search & batch scraping API with residential proxies (1000 free) | API Key | Yes | No | ↗ |
| AmberOne Turn any website into a build-ready Android, iOS, PWA or Electron app project | API Key | Yes | No | ↗ |
| API Grátis Multiples services and public APIs | No auth | Yes | Unknown | ↗ |