---
title: Database
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/typescript)

[D1](https://developers.cloudflare.com/api/typescript/resources/d1)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Database

##### [List D1 Databases](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/list)

client.d1.database.list(DatabaseListParams {account\_id, name, page, per\_page } params, RequestOptionsoptions?): V4PagePaginationArray< [DatabaseListResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)>) {created\_at, jurisdiction, name, 2 more } >

GET/accounts/{account\_id}/d1/database

##### [Get D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/get)

client.d1.database.get(stringdatabaseID, DatabaseGetParams {account\_id, fields } params, RequestOptionsoptions?): [D1](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>) {created\_at, file\_size, jurisdiction, 5 more }

GET/accounts/{account\_id}/d1/database/{database\_id}

##### [Create D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/create)

client.d1.database.create(DatabaseCreateParams {account\_id, name, jurisdiction, 2 more } params, RequestOptionsoptions?): [D1](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>) {created\_at, file\_size, jurisdiction, 5 more }

POST/accounts/{account\_id}/d1/database

##### [Update D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/update)

client.d1.database.update(stringdatabaseID, DatabaseUpdateParams {account\_id, read\_replication } params, RequestOptionsoptions?): [D1](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>) {created\_at, file\_size, jurisdiction, 5 more }

PUT/accounts/{account\_id}/d1/database/{database\_id}

##### [Update D1 Database partially](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/edit)

client.d1.database.edit(stringdatabaseID, DatabaseEditParams {account\_id, read\_replication } params, RequestOptionsoptions?): [D1](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>) {created\_at, file\_size, jurisdiction, 5 more }

PATCH/accounts/{account\_id}/d1/database/{database\_id}

##### [Delete D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/delete)

client.d1.database.delete(stringdatabaseID, DatabaseDeleteParams {account\_id } params, RequestOptionsoptions?): [DatabaseDeleteResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_delete_response%20%3E%20(schema)>)| null

DELETE/accounts/{account\_id}/d1/database/{database\_id}

##### [Query D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/query)

client.d1.database.query(stringdatabaseID, DatabaseQueryParamsparams, RequestOptionsoptions?): SinglePage< [QueryResult](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)>) {meta, results, success } >

POST/accounts/{account\_id}/d1/database/{database\_id}/query

##### [Raw D1 Database query](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/raw)

client.d1.database.raw(stringdatabaseID, DatabaseRawParamsparams, RequestOptionsoptions?): SinglePage< [DatabaseRawResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)>) {meta, results, success } >

POST/accounts/{account\_id}/d1/database/{database\_id}/raw

##### [Export D1 Database as SQL](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/export)

client.d1.database.export(stringdatabaseID, DatabaseExportParams {account\_id, output\_format, current\_bookmark, dump\_options } params, RequestOptionsoptions?): [DatabaseExportResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)>) {at\_bookmark, error, messages, 4 more }

POST/accounts/{account\_id}/d1/database/{database\_id}/export

##### [Import SQL into your D1 Database](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/methods/import)

client.d1.database.import(stringdatabaseID, DatabaseImportParamsparams, RequestOptionsoptions?): [DatabaseImportResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)>) {at\_bookmark, error, filename, 6 more }

POST/accounts/{account\_id}/d1/database/{database\_id}/import

##### ModelsExpand Collapse

<details>

<summary>

QueryResult {meta, results, success }

</summary>

<details>

<summary>

meta?: Meta {changed\_db, changes, duration, 8 more }

</summary>

changed\_db?: boolean

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes?: number

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id?: number

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read?: number

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written?: number

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo?: string

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary?: boolean

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region?: "WNAM"| "ENAM"| "WEUR"| 3 more

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after?: number

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings?: Timings {sql\_duration\_ms }

Various durations for the query.

</summary>

sql\_duration\_ms?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta">Link to this property</a>

results?: Array&lt;unknown&gt;

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20results">Link to this property</a>

success?: boolean

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)>)

<details>

<summary>

DatabaseListResponse {created\_at, jurisdiction, name, 2 more }

</summary>

created\_at?: string

Specifies the timestamp the resource was created as an ISO8601 string.

formatdate-time

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

<details>

<summary>

jurisdiction?: "eu"| "fedramp"| "us"| null

Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored.

</summary>

One of the following:

"eu"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%200">Link to this property</a>

"fedramp"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%201">Link to this property</a>

"us"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction">Link to this property</a>

name?: string

D1 database name.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

uuid?: string

D1 database identifier (UUID).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20uuid">Link to this property</a>

version?: string

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20version">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)>)

DatabaseDeleteResponse = unknown

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_delete_response%20%3E%20(schema)>)

<details>

<summary>

DatabaseRawResponse {meta, results, success }

</summary>

<details>

<summary>

meta?: Meta {changed\_db, changes, duration, 8 more }

</summary>

changed\_db?: boolean

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes?: number

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id?: number

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read?: number

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written?: number

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo?: string

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary?: boolean

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region?: "WNAM"| "ENAM"| "WEUR"| 3 more

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after?: number

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings?: Timings {sql\_duration\_ms }

Various durations for the query.

</summary>

sql\_duration\_ms?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta">Link to this property</a>

<details>

<summary>

results?: Results {columns, rows }

</summary>

columns?: Array&lt;string&gt;

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20columns">Link to this property</a>

<details>

<summary>

rows?: Array&lt;Array&lt;number| string| unknown&gt;&gt;

</summary>

One of the following:

number

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

string

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

unknown

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results">Link to this property</a>

success?: boolean

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)>)

<details>

<summary>

DatabaseExportResponse {at\_bookmark, error, messages, 4 more }

</summary>

at\_bookmark?: string

The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the export task.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20at_bookmark">Link to this property</a>

error?: string

Only present when status = ‘error’. Contains the error message.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20error">Link to this property</a>

messages?: Array&lt;string&gt;

Logs since the last time you polled

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

<details>

<summary>

result?: Result {filename, signed\_url }

Only present when status = ‘complete’

</summary>

filename?: string

The generated SQL filename.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20filename">Link to this property</a>

signed\_url?: string

The URL to download the exported SQL. Available for one hour.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20signed_url">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result">Link to this property</a>

<details>

<summary>

status?: "complete"| "error"

</summary>

One of the following:

"complete"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"error"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

success?: boolean

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

type?: "export"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)>)

<details>

<summary>

DatabaseImportResponse {at\_bookmark, error, filename, 6 more }

</summary>

at\_bookmark?: string

The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the import. Only returned if an import process is currently running or recently finished.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20at_bookmark">Link to this property</a>

error?: string

Only present when status = ‘error’. Contains the error message that prevented the import from succeeding.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20error">Link to this property</a>

filename?: string

Derived from the database ID and etag, to use in avoiding repeated uploads. Only returned when for the ‘init’ action.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20filename">Link to this property</a>

messages?: Array&lt;string&gt;

Logs since the last time you polled

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

<details>

<summary>

result?: Result {final\_bookmark, meta, num\_queries }

Only present when status = ‘complete’

</summary>

final\_bookmark?: string

The time-travel bookmark if you need restore your D1 to directly after the import succeeded.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20final_bookmark">Link to this property</a>

<details>

<summary>

meta?: Meta {changed\_db, changes, duration, 8 more }

</summary>

changed\_db?: boolean

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes?: number

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id?: number

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read?: number

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written?: number

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo?: string

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary?: boolean

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region?: "WNAM"| "ENAM"| "WEUR"| 3 more

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after?: number

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings?: Timings {sql\_duration\_ms }

Various durations for the query.

</summary>

sql\_duration\_ms?: number

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta">Link to this property</a>

num\_queries?: number

The total number of queries that were executed during the import.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20num_queries">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result">Link to this property</a>

<details>

<summary>

status?: "complete"| "error"

</summary>

One of the following:

"complete"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"error"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

success?: boolean

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

type?: "import"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

upload\_url?: string

The R2 presigned URL to use for uploading. Only returned when for the ‘init’ action.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20upload_url">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)>)

#### DatabaseTime Travel

##### [Get D1 database bookmark](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/subresources/time_travel/methods/get_bookmark)

client.d1.database.timeTravel.getBookmark(stringdatabaseID, TimeTravelGetBookmarkParams {account\_id, timestamp } params, RequestOptionsoptions?): [TimeTravelGetBookmarkResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)>) {bookmark }

GET/accounts/{account\_id}/d1/database/{database\_id}/time\_travel/bookmark

##### [Restore D1 Database to a bookmark or point in time](https://developers.cloudflare.com/api/typescript/resources/d1/subresources/database/subresources/time_travel/methods/restore)

client.d1.database.timeTravel.restore(stringdatabaseID, TimeTravelRestoreParams {account\_id, bookmark, timestamp } params, RequestOptionsoptions?): [TimeTravelRestoreResponse](<https://developers.cloudflare.com/api/typescript/resources/d1#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)>) {bookmark, message, previous\_bookmark }

POST/accounts/{account\_id}/d1/database/{database\_id}/time\_travel/restore

##### ModelsExpand Collapse

<details>

<summary>

TimeTravelGetBookmarkResponse {bookmark }

</summary>

bookmark?: string

A bookmark representing a specific state of the database at a specific point in time.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)%20%3E%20(property)%20bookmark">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)>)

<details>

<summary>

TimeTravelRestoreResponse {bookmark, message, previous\_bookmark }

Response from a time travel restore operation.

</summary>

bookmark?: string

The new bookmark representing the state of the database after the restore operation.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20bookmark">Link to this property</a>

message?: string

A message describing the result of the restore operation.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20message">Link to this property</a>

previous\_bookmark?: string

The bookmark representing the state of the database before the restore operation. Can be used to undo the restore if needed.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20previous_bookmark">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)>)