D1

D1Resource

Domain types

D1{…}

The details of the D1 database.

D1

Database

D1Resource.Database

Methods

list(, ): <>
get/accounts/{account_id}/d1/database

Returns a list of D1 databases.

get(, , ):
get/accounts/{account_id}/d1/database/{database_id}

Returns the specified D1 database.

create(, ):
post/accounts/{account_id}/d1/database

Returns the created D1 database.

update(, , ):
put/accounts/{account_id}/d1/database/{database_id}

Updates the specified D1 database.

edit(, , ):
patch/accounts/{account_id}/d1/database/{database_id}

Updates partially the specified D1 database.

delete(, , ): | null
delete/accounts/{account_id}/d1/database/{database_id}

Deletes the specified D1 database.

query(, , ): <>
post/accounts/{account_id}/d1/database/{database_id}/query

Returns the query result as an object.

raw(, , ): <>
post/accounts/{account_id}/d1/database/{database_id}/raw

Returns the query result rows as arrays rather than objects. This is a performance-optimized version of the /query endpoint.

export(, , ):
post/accounts/{account_id}/d1/database/{database_id}/export

Returns a URL where the SQL contents of your D1 can be downloaded. Note: this process may take some time for larger DBs, during which your D1 will be unavailable to serve queries. To avoid blocking your DB unnecessarily, an in-progress export must be continually polled or will automatically cancel.

import(, , ):
post/accounts/{account_id}/d1/database/{database_id}/import

Generates a temporary URL for uploading an SQL file to, then instructing the D1 to import it and polling it for status updates. Imports block the D1 for their duration.

Domain types

QueryResult{…}
D1Database

Time Travel

D1Resource.Database.TimeTravel

Methods

getBookmark(, , ):
get/accounts/{account_id}/d1/database/{database_id}/time_travel/bookmark

Retrieves the current bookmark, or the nearest bookmark at or before a provided timestamp. Bookmarks can be used with the restore endpoint to revert the database to a previous point in time.

restore(, , ):
post/accounts/{account_id}/d1/database/{database_id}/time_travel/restore

Restores a D1 database to a previous point in time either via a bookmark or a timestamp.