Databases
REST endpoints for databases. Bearer-auth required.
GET /api/databases
List databases with pagination.
Query parameters
limit(optional): Page size (1–100, default 100).after(optional): Keyset cursor — return the page after this row (next page).before(optional): Keyset cursor — return the page before this row (prev page).ids(optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).filter(optional): Nested filter expression (<Entity>Filter): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.orderBy(optional): Multi-key sort (<Entity>OrderBy[]): array of{ field: direction }applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.workspace_id(optional): Filter to databases in this workspace. When omitted, returns databases across every workspace the caller is a member of (admins see all).include_deleted(optional): Soft-deleted database visibility.false(default) — active rows only.true— active plus soft-deleted.only— soft-deleted only.name(optional): Case-insensitive substring match on name.source(optional): Narrow by source.workspace= this workspace's rows plus those visible via installed integrations;integration= only rows made visible by installed integrations; omit = union.kind(optional): Shorthand: filter wherekindequals this value.status(optional): Shorthand: filter wherestatusequals this value.created_by(optional): Shorthand: filter wherecreatedByequals this value.retention_tier(optional): Shorthand: filter whereretentionTierequals this value.
Response
JSON
{
"data": [
{
"id": "<...>",
"workspaceId": "<...>",
"slug": "<...>",
"name": "<...>",
"description": "<...>",
"kind": "<...>",
"status": "<...>",
"cfResourceId": "<...>",
"cfResourceName": "<...>",
"createdBy": "<...>",
"deletedAt": "<...>",
"retentionTier": "<...>",
"createdAt": "<...>",
"updatedAt": "<...>"
}
],
"pageInfo": {
"total": "number",
"hasNextPage": "boolean",
"hasPreviousPage": "boolean",
"startCursor": "string",
"endCursor": "string"
}
}POST /api/databases
Create database
Request body
JSON
{
"workspaceId": "string",
"name": "string",
"slug?": "string",
"description?": "string",
"kind?": "any"
}Response
JSON
{
"id": "string",
"workspaceId": "string",
"slug": "string",
"name": "string",
"description": "string",
"kind": "d1",
"status": "provisioning | ready | failed",
"cfResourceId": "string",
"cfResourceName": "string",
"createdBy": "string",
"deletedAt": "string",
"retentionTier": "any",
"createdAt": "string",
"updatedAt": "string"
}GET /api/databases/{id}
Get a database by ID.
Path parameters
id(required): Database to retrieve.
Response
JSON
{
"id": "string",
"workspaceId": "string",
"slug": "string",
"name": "string",
"description": "string",
"kind": "d1",
"status": "provisioning | ready | failed",
"cfResourceId": "string",
"cfResourceName": "string",
"createdBy": "string",
"deletedAt": "string",
"retentionTier": "any",
"createdAt": "string",
"updatedAt": "string"
}PATCH /api/databases/{id}
Update database
Path parameters
id(required): The database's prefixed ID (e.g.dbs_...).
Request body
JSON
{
"name?": "string",
"description?": "string"
}Response
JSON
{
"id": "string",
"workspaceId": "string",
"slug": "string",
"name": "string",
"description": "string",
"kind": "d1",
"status": "provisioning | ready | failed",
"cfResourceId": "string",
"cfResourceName": "string",
"createdBy": "string",
"deletedAt": "string",
"retentionTier": "any",
"createdAt": "string",
"updatedAt": "string"
}DELETE /api/databases/{id}
Soft-delete a database. The underlying D1 instance stays live until purge.
Path parameters
id(required): Database to soft-delete.
Response
JSON
{
"success": "boolean"
}DELETE /api/databases/{id}/purge
Permanently delete a soft-deleted database.
Path parameters
id(required): Soft-deleted database to permanently delete.
Response
JSON
{
"success": "boolean"
}POST /api/databases/{id}/query
Execute SQL
Path parameters
id(required): The database's prefixed ID (e.g.dbs_...).
Request body
JSON
{
"query": "string",
"params?": ["any"]
}Response
JSON
{
"columns": ["<...>"],
"rows": [{}],
"rowsRead?": "number",
"rowsWritten?": "number",
"durationMs": "number"
}POST /api/databases/{id}/restore
Restore a soft-deleted database.
Path parameters
id(required): Soft-deleted database to restore.
Response
JSON
{
"id": "string",
"workspaceId": "string",
"slug": "string",
"name": "string",
"description": "string",
"kind": "d1",
"status": "provisioning | ready | failed",
"cfResourceId": "string",
"cfResourceName": "string",
"createdBy": "string",
"deletedAt": "string",
"retentionTier": "any",
"createdAt": "string",
"updatedAt": "string"
}GET /api/databases/{id}/tables
List tables
Path parameters
id(required): The database's prefixed ID (e.g.dbs_...).
Response
JSON
{
"tables": ["<...>"]
}GET /api/databases/{id}/tables/{tableName}
Describe table
Path parameters
id(required): The database's prefixed ID (e.g.dbs_...).tableName(required): Table name within the database.
Response
JSON
{
"name": "string",
"columns": ["<...>"],
"rowCount": "number"
}GET /api/databases/{id}/tables/{tableName}/rows
Browse table rows
Path parameters
id(required): The database's prefixed ID (e.g.dbs_...).tableName(required): Table name within the database.
Query parameters
limit(optional): Max rows to return (1-500, default 100).offset(optional): Skip this many rows from the start.
Response
JSON
{
"columns": ["<...>"],
"rows": [{}],
"total": "number",
"limit": "number",
"offset": "number"
}