Skip to main content
A D1 connection is three strings: the database name, your Cloudflare account ID, and an API token. Every query leaves as an HTTPS request to the Cloudflare API, and the dialect on the other end is SQLite. The Cloudflare D1 driver is not in the app. Picking Cloudflare D1 in the Choose a Database sheet offers the download before the form opens, and opening a saved Cloudflare D1 connection installs it without asking. See Plugins.

Connection settings

No host, no port, and no SSL Mode: the endpoint is fixed and always HTTPS.
Cloudflare D1 connection form with Database, Account ID, and API Token fieldsCloudflare D1 connection form with Database, Account ID, and API Token fields

The Cloudflare D1 connection form

Click Test Connection to verify, then Save & Connect.

Connection URL

The token is not in the URL. See Connection URL Reference.

Getting your credentials

1

Copy the account ID

It is in the right sidebar of the Cloudflare dashboard, or run npx wrangler whoami.
2

Create the token

On Cloudflare API Tokens, click Create Token, pick the Custom token template, and add the permission Account > D1 > Edit.
3

Save and copy it

Cloudflare shows the token once. Paste it into API Token.
The token reaches every D1 database in its account, not only the one you connect to.

Databases and schema

The toolbar’s database switcher lists every D1 database in the account and moves between them without reconnecting. It creates and drops them too. A tab keeps the database it opened on for its whole life: see Tabs. Browsing, EXPLAIN QUERY PLAN, data editing, and export behave as they do for SQLite.

Limitations

  • Nothing survives between statements. Each query is an independent HTTP request with no session state: PRAGMA settings and temp tables do not carry. Put what a statement needs into that statement.
  • No multi-statement transactions. Every statement auto-commits alone, with no rollback.
  • A column cannot be renamed or retyped, and a foreign key cannot be edited. Recreate the table and copy the rows across.
  • No bulk import through the plugin. Run wrangler d1 execute <name> --file=dump.sql, which needs wrangler installed.
  • 10 GB per database, Cloudflare’s limit. Shard across databases for more.
  • Cloudflare’s API rate limits apply. A limited request surfaces as an error carrying the retry delay Cloudflare returned.
  • A binary value cannot be written through the API. Saving a BLOB cell fails with Cloudflare D1 cannot bind a binary value through its API. Write the value in a query as an X'…' literal instead.
  • On iPhone and iPad an edited value travels inside its statement, and D1 refuses a statement over 100 KB. Edit a larger value on the Mac.

Troubleshooting

Authentication failed. Check your API token and Account ID.

Cloudflare refused the token for this account. Check that the token has Account > D1 > Edit and that the Account ID is the account that owns the database. Create a new token if this one expired or was revoked.

Database ’…’ not found in account

The account holds no database by that name or UUID. Confirm it with wrangler d1 list. Check that the token reaches the account that owns it.

’…’ is not a Cloudflare D1 database name or UUID

A D1 name holds only letters, digits, - and _, and starts with a letter or digit. Look for a typo or a pasted space in Database. Paste the database UUID from the Cloudflare dashboard instead.

Rate limited by Cloudflare. Retry after … seconds.

The account used up its API requests for the moment. Wait the stated interval. If it repeats, refresh less often and lower the page size.