> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-feat-ai-sql-walkthroughs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare D1

> Connect to Cloudflare D1 databases over the Cloudflare REST API

# Cloudflare D1 Connections

TablePro connects to Cloudflare D1, a serverless SQLite-compatible database, via the Cloudflare REST API. No direct database connection or SSH tunnel is involved. The driver is a downloadable plugin; TablePro offers to install it when you select **Cloudflare D1** in the connection form. See [Plugins](/features/plugins).

## Connection Settings

| Field          | Description                                                                                                                                             |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Database**   | D1 database name or UUID. Names resolve to the UUID automatically via the Cloudflare API.                                                               |
| **Account ID** | Your Cloudflare account ID                                                                                                                              |
| **API Token**  | Cloudflare API token with D1 permissions, entered in the built-in password field (labeled **API Token** for this driver). Stored in the macOS Keychain. |

<Frame caption="The Cloudflare D1 connection form">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/cloudflare-d1-connection-form.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=e00518d066eb63a8d00297e5ee801130" alt="Cloudflare D1 connection form with Database, Account ID, and API Token fields" width="1560" height="960" data-path="images/cloudflare-d1-connection-form.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/cloudflare-d1-connection-form-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=e519efc7f3a486e0591421d7c15bda0c" alt="Cloudflare D1 connection form with Database, Account ID, and API Token fields" width="1560" height="960" data-path="images/cloudflare-d1-connection-form-dark.png" />
</Frame>

Click **Test Connection** to verify, then **Save & Connect**.

## Getting Your Credentials

**Account ID**: On the [Cloudflare dashboard](https://dash.cloudflare.com) right sidebar, or `npx wrangler whoami`.

**API Token**:

1. Go to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens)
2. Click **Create Token** and pick the **Custom token** template
3. Add permission **Account** > **D1** > **Edit**
4. Save and copy the token

<Warning>
  The token grants access to all D1 databases in your account. Scope it to the account you need.
</Warning>

## Database Management

Use the database switcher in the toolbar to list every D1 database in your account and switch between them without reconnecting. You can also create and drop D1 databases directly from TablePro, or with `wrangler d1 create <name>`.

## Schema and Triggers

The structure editor works for D1: add, modify, and drop columns via generated `ALTER TABLE` DDL. Triggers can be viewed and edited from the sidebar.

## SQL Dialect

D1 uses SQLite syntax; browsing, structure, EXPLAIN QUERY PLAN, data editing, and export work as they do for SQLite. See [SQLite](/databases/sqlite).

## Troubleshooting

**Authentication failed**: Check the token has **D1 Edit** permission, the Account ID matches, and the token has not expired or been revoked.

**Database not found**: Verify the name or UUID with `wrangler d1 list` and confirm the token can access the account that owns the database.

## Known Limitations

* No persistent connections: each query is an independent HTTP request with no session state
* No multi-statement transactions: each SQL statement auto-commits independently
* 10 GB limit per D1 database; shard for larger datasets
* Cloudflare API rate limits apply; TablePro surfaces rate limit errors with retry timing
* No bulk import through the plugin: use `wrangler d1 execute` with SQL files
* No custom SSL/SSH: D1 is HTTPS-only via the Cloudflare API
