Cloudflare D1 API logo

Cloudflare D1 API

Cloudflare D1 API

Cloudflare D1 is Cloudflare globally distributed SQLite — millisecond access within Workers, global read replicas, SQL-compatible, generous free tier.

Visit site ↗Documentation ↗Health checked 12h ago
Use it when

Zero network latency within Workers

Watch for

Optimal only within Cloudflare Workers (external access via HTTP API)

First check

wrangler CLI: wrangler d1 create my-database. Configure D1 binding in wrangler.toml. In Workers: env.DB.prepare("SELECT * FROM users").all()

Auth
api_key
CORS
?
HTTPS
Yes
Signup
?
Latency
101 ms
Protocol
REST, SQL
Pricing
freemium

Uptime · 30-day window

Probes: 31Uptime: 100%Avg latency: 212ms
01

About this API

D1 is Cloudflare's globally distributed SQLite database launched 2022, the relational DB part of Cloudflare's full-stack platform (Workers + R2 + KV + Durable Objects + D1 + Queues). Design core: (1) Based on SQLite (small, fast, single file); (2) Global read replicas (writes to primary region, reads distributed globally, app latency follows users); (3) Deep Cloudflare Workers integration (Worker-to-D1 call has no HTTP hop). vs. Turso: D1 is Cloudflare-exclusive (optimal only within Workers), Turso is cross-platform. vs. Vercel Postgres (Neon-based): D1 SQLite vs. Vercel Postgres. Generous free tier (100k reads + 50k writes/day), hobby / small SaaS perfectly sufficient. Cloudflare customers use D1 with Workers to build "zero cold-start + global < 50ms" apps.

02

What you can build

  • 1Cloudflare Workers application DB
  • 2Global users low-latency reads (per-region local replica)
  • 3Small SaaS / blog / SaaS dashboard backend
  • 4Serverless app SQL data storage
03

Strengths & limitations

Strengths

  • Zero network latency within Workers
  • Auto global read replicas
  • Generous free tier (100k reads + 50k writes/day)
  • Familiar SQL (SQLite-compatible)

Limitations

  • Optimal only within Cloudflare Workers (external access via HTTP API)
  • SQLite limitations (not for ultra-high concurrent writes)
  • 10GB per DB limit
04

Official quickstart

Read the official quickstart at developers.cloudflare.com.

05

Getting started

wrangler CLI: wrangler d1 create my-database. Configure D1 binding in wrangler.toml. In Workers: env.DB.prepare("SELECT * FROM users").all()

06

FAQ

D1 vs. Cloudflare KV?+

KV is simple key-value cache. D1 is real SQL DB (relations, JOINs, transactions).

Can D1 be used outside Workers?+

Yes via HTTP REST API, but latency is an order of magnitude higher than in-Worker direct calls.

07

Technical details

CORS: ?HTTPS: YesSignup: ?Open source: No
Auth type
api_key
Pricing
freemium
Rate limit
免费 100k reads + 50k writes/天
Protocols
REST, SQL
SDKs
javascript, typescript
Response time
101 ms
Last health check
6/26/2026, 6:22:55 AM
08

Tags