Cloudflare D1 D1 API

The D1 API from Cloudflare D1 — 8 operation(s) for d1.

GitHub OpenAPI
Business capability
IT Infrastructure Management BC-600.50

Operations 12

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /accounts/{account_id}/d1/database List D1 databases in an account · List D1 Databases #
Ask an LLM
“Which D1 databases exist in my account?”
“Can I find a D1 database by name?”
Tell an agent
List D1 databases in account {account_id}.
Find the D1 database named {name} in account {account_id}.
POST /accounts/{account_id}/d1/database Create a D1 database · Create D1 Database #
Ask an LLM
“How do I create a new D1 database?”
“Can I choose the primary location for a new D1 database?”
Tell an agent
Create a D1 database named {name} in account {account_id}.
Create D1 database {name} in account {account_id} with primary location hint {primary_location_hint}.
DELETE /accounts/{account_id}/d1/database/{database_id} Delete a D1 database · Delete D1 Database #
Ask an LLM
“How do I delete a D1 database?”
“Can I permanently remove a D1 database from my account?”
Tell an agent destructive · confirm first
Delete D1 database {database_id} in account {account_id}.
Permanently remove D1 database {database_id} from account {account_id}.
GET /accounts/{account_id}/d1/database/{database_id} Get a D1 database · Get D1 Database #
Ask an LLM
“What are the details of one D1 database?”
“Can I fetch specific fields of a D1 database?”
Tell an agent
Get D1 database {database_id} in account {account_id}.
Show fields {fields} of D1 database {database_id} in account {account_id}.
PATCH /accounts/{account_id}/d1/database/{database_id} Partially update a D1 database · Update D1 Database partially #
Ask an LLM
“Can I change only the read replication of a D1 database?”
“Is there a partial update for D1 databases?”
Tell an agent
Partially update D1 database {database_id} in account {account_id} with read replication {read_replication}.
Patch D1 database {database_id} in account {account_id} so it reads from {read_replication}.
PUT /accounts/{account_id}/d1/database/{database_id} Replace a D1 database's read replication · Update D1 Database #
Ask an LLM
“How do I change a D1 database's read replication settings?”
“Can I overwrite the whole read replication configuration of a D1 database?”
Tell an agent
Replace the read replication of D1 database {database_id} in account {account_id} with {read_replication}.
Set D1 database {database_id} in account {account_id} to read replication {read_replication}.
POST /accounts/{account_id}/d1/database/{database_id}/export Export a D1 database as SQL · Export D1 Database as SQL #
Ask an LLM
“How do I export my D1 database to SQL?”
“How long does a D1 database export take?”
Tell an agent
Export D1 database {database_id} in account {account_id} as SQL.
Start a SQL export of D1 database {database_id} in account {account_id} in format {output_format}.
POST /accounts/{account_id}/d1/database/{database_id}/import Import SQL into a D1 database · Import SQL into your D1 Database #
Ask an LLM
“How do I load an SQL file into my D1 database?”
“Does importing block the D1 database while it runs?”
Tell an agent
Generate an upload URL for importing SQL into D1 database {database_id} in account {account_id}.
Start importing an SQL file into D1 database {database_id} in account {account_id}.
POST /accounts/{account_id}/d1/database/{database_id}/query Query a D1 database · Query D1 Database #
Ask an LLM
“How do I run a SQL query against my D1 database?”
“Can I fetch query results as objects?”
Tell an agent
Query D1 database {database_id} in account {account_id}.
Run a SQL query on D1 database {database_id} in account {account_id} and return results as objects.
POST /accounts/{account_id}/d1/database/{database_id}/raw Query a D1 database and return rows as arrays · Raw D1 Database query #
Ask an LLM
“Is there a faster way to get D1 query results as arrays?”
“Can I get raw row arrays instead of objects from a D1 query?”
Tell an agent
Run a raw query on D1 database {database_id} in account {account_id} returning rows as arrays.
Fetch D1 database {database_id} row arrays in account {account_id} without object conversion.
GET /accounts/{account_id}/d1/database/{database_id}/time_travel/bookmark Get a D1 database bookmark · Get D1 database bookmark #
Ask an LLM
“What is the current bookmark of my D1 database?”
“Can I get a D1 database bookmark for a past timestamp?”
Tell an agent
Get the current bookmark of D1 database {database_id} in account {account_id}.
Get the D1 database {database_id} bookmark at or before {timestamp} in account {account_id}.
POST /accounts/{account_id}/d1/database/{database_id}/time_travel/restore Restore a D1 database to a bookmark or timestamp · Restore D1 Database to a bookmark or point in time #
Ask an LLM
“How do I restore a D1 database to a previous point in time?”
“Can I roll back a D1 database using a bookmark?”
Tell an agent destructive · confirm first
Restore D1 database {database_id} in account {account_id} to bookmark {bookmark}.
Roll back D1 database {database_id} in account {account_id} to {timestamp}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudflare-d1:cloudflare-d1-d1-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudflare-d1-d1-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudflare D1 API
  description: REST API for managing and querying Cloudflare D1 serverless SQLite databases. Provides endpoints for database lifecycle management (create, list, get, delete), SQL query execution (query and raw modes), data import/export, and Time Travel point-in-time restore operations.
  version: 4.0.0
  contact:
    name: Cloudflare Support
    url: https://developers.cloudflare.com/support/
  license:
    name: BSD 3-Clause
    url: https://github.com/cloudflare/cloudflare-python/blob/main/LICENSE
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4
security:
- api_token: []
- api_key: []
  api_email: []
tags:


# --- truncated at 32 KB (43 KB total) ---
# Full source: https://artifacts.apis.io/cloudflare-d1/openapi/cloudflare-d1-d1-api-openapi.yml