cloudflare
The official Python library for the cloudflare API
Decision gist · record as of 2026-08-14
Yes. This is the official, actively maintained Cloudflare Python client with low install friction, no known vulnerabilities, permissive licensing, and strong type support. Install it if you need to interact with Cloudflare's API from Python—it is the canonical choice for this task.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later and a valid Cloudflare API token (typically provided via environment variable).
- Low install friction with a pure-Python wheel.
- Actively maintained with a recent release (23 days old) and 494 repository stars.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers.
last release 2026-07-22 (23 days) · last repo commit 2026-08-14 · 494 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 10,122,213 downloads/mo, #1,480 on PyPI
Alternatives
Verify before relying
pip install cloudflare
import os
from cloudflare import Cloudflare
client = Cloudflare(api_token=os.environ.get("CLOUDFLARE_API_TOKEN"))
zone = client.zones.create(
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
name="example.com",
type="full",
)
print(zone.id)- Rate limit handling and retry behavior beyond the documented default 2 retries with exponential backoff.
- Performance characteristics of the async client with aiohttp versus httpx under high concurrency.
- Completeness of API coverage relative to the full Cloudflare REST API surface.
What it is and what it does
This is the official Python client for the Cloudflare REST API, generated using Stainless. It wraps Cloudflare's full API surface—zones, accounts, DNS records, KV storage, and more—in a typed, modern Python interface. The library ships with both synchronous and asynchronous clients powered by httpx, and includes full type definitions for request parameters and response objects using Pydantic models and TypedDicts.
The client handles pagination automatically, error classification (connection errors, rate limits, authentication failures, and HTTP status codes), and retries certain transient failures by default. It supports file uploads, nested parameters, and provides helper methods on response objects for serialization. You can optionally swap the HTTP backend to aiohttp for improved async concurrency. The library targets Python 3.9+ and is actively maintained.
Use it for
- Manage DNS records, zones, and accounts programmatically for multi-tenant or infrastructure-as-code workflows.
- Build async applications that interact with Cloudflare's KV storage, Workers, or other edge services.
- Automate SSL/TLS certificate provisioning, firewall rules, or DDoS protection settings.
- Integrate Cloudflare API calls into monitoring or observability platforms with typed, autocomplete-friendly code.
- Paginate through large lists of accounts, zones, or DNS records without manual page handling.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is the official, actively maintained Cloudflare Python client with low install friction, no known vulnerabilities, permissive licensing, and strong type support. Install it if you need to interact with Cloudflare's API from Python—it is the canonical choice for this task.
Install
cloudflare on PyPI
Before you install
Low install friction with a pure-Python wheel. Actively maintained with a recent release (23 days old) and 494 repository stars. Supports current Python versions (3.9+) and has no known vulnerabilities.
Requires Python 3.9 or later and a valid Cloudflare API token (typically provided via environment variable).
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
pip install cloudflare
import os
from cloudflare import Cloudflare
client = Cloudflare(api_token=os.environ.get("CLOUDFLARE_API_TOKEN"))
zone = client.zones.create(
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
name="example.com",
type="full",
)
print(zone.id)
Verify before relying
- Rate limit handling and retry behavior beyond the documented default 2 retries with exponential backoff.
- Performance characteristics of the async client with aiohttp versus httpx under high concurrency.
- Completeness of API coverage relative to the full Cloudflare REST API surface.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesanyiodistrohttpxpydanticsniffiotyping-extensions |
| Maintenance | Actively maintained 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,122,213 / month, #1,480 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: cloudflare-5.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “cloudflare api client”
- cloudflareProvides a Python client library for the Cloudflare REST API with…
- 2captcha-pythonA Python client for the 2Captcha API that automates captcha solving…
- pulumi-cloudflarePulumi provider for Cloudflare that lets you define and manage…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also arcadepy · runwayml · composio-client · steel-sdk · flask-cloudflared · sambanova · kernel · postgrid-python · supermemory · glean-api-client