Official Python SDK for the Cloudflare REST API, with sync and async clients and typed requests and responses.
cloudflare/cloudflare-typescript
Official TypeScript/JavaScript client library for the Cloudflare REST API, generated with Stainless.
- Stars
- 831
- Forks
- 199
- Open issues
- 20
- Last commit
- 2 days ago
What is it?
This is the official server-side TypeScript and JavaScript client for the Cloudflare REST API. It wraps the API's resources, such as zones, accounts and KV namespaces, as typed methods with request parameter and response field definitions, so developers can call Cloudflare services without hand-writing HTTP requests.
The library handles common concerns out of the box: automatic retries with exponential backoff for connection errors and 408, 409, 429 and 5xx responses, configurable timeouts, typed error classes for each HTTP status, and auto-pagination through list endpoints with `for await` loops. File uploads accept Node streams, web File objects, fetch Responses or a helper for raw bytes.
It runs in browsers, Node.js 20+, Deno, Bun, Cloudflare Workers and Vercel Edge Runtime, and supports a tree-shakable entry point for smaller bundles. The library is generated with Stainless, and the full method list is in api.md.
Key features
- 01Typed methods and parameter definitions for Cloudflare API resources
- 02Automatic retries with exponential backoff, configurable via maxRetries
- 03Typed error classes for each HTTP status code
- 04Auto-pagination for list endpoints using for await loops
- 05File upload support for Node streams, File objects and Responses
- 06Tree-shakable client that includes only selected resources
Use cases
- Automating DNS zone creation and management from a Node.js deployment script
- Managing Cloudflare KV namespaces or accounts from a backend service
- Calling Cloudflare APIs from Cloudflare Workers or Vercel Edge functions
- Building internal tooling that needs typed access to Cloudflare resources
Quick start
- 1
Install the library from the repository via npm
npm install git+ssh://git@github.com:cloudflare/cloudflare-typescript.git - 2
Create a client with your API token from the environment and call the API
Things to know
- Not yet published to npm, so installation currently goes through a Git SSH URL.
- Requires a Cloudflare API token to make calls.
Topics
FAQ
- What is cloudflare-typescript?
- Official TypeScript/JavaScript client library for the Cloudflare REST API, generated with Stainless. This is the official server-side TypeScript and JavaScript client for the Cloudflare REST API. It wraps the API's resources, such as zones, accounts and KV namespaces, as typed methods with request parameter and response field definitions, so developers can call Cloudflare services without hand-writing HTTP requests.
- Is cloudflare-typescript free to use? What license does it have?
- cloudflare-typescript is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is cloudflare-typescript still maintained?
- Actively maintained. The last commit to cloudflare-typescript was on Nov 5, 2026.
- What can I use cloudflare-typescript for?
- Automating DNS zone creation and management from a Node.js deployment script Managing Cloudflare KV namespaces or accounts from a backend service Calling Cloudflare APIs from Cloudflare Workers or Vercel Edge functions Building internal tooling that needs typed access to Cloudflare resources
- How do I install cloudflare-typescript?
- Install the library from the repository via npm: npm install git+ssh://git@github.com:cloudflare/cloudflare-typescript.git Create a client with your API token from the environment and call the API
- Where can I get cloudflare-typescript?
- The source code and installation instructions are on GitHub: https://github.com/cloudflare/cloudflare-typescript
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A lightweight Go tool that automatically detects your public IPv4/IPv6 address and updates DNS records at many DNS providers.
Infrastructure as Code for DNS: define DNS records in a JavaScript-based config and push them to many providers.
A lightweight, self-hosted program that periodically updates DNS A/AAAA records across many DNS providers, with a web UI.
Self-hosted tool that automatically creates Cloudflare Tunnel routes, DNS records and Access policies from Docker container labels.
Self-hosted server control panel for deploying web apps, managing databases, Docker containers, DNS, backups and security on a VPS or dedicated server.