---
title: "Database"
description: "The `Database` entity."
section: "Reference"
group: "Types"
order: 57
---

## Definition

```ts
interface Database {
  id: string;
  workspaceId: string;
  slug: string;
  name: string;
  description: string | null;
  kind: "d1";
  status: "failed" | "ready" | "provisioning";
  cfResourceId: string | null;
  cfResourceName: string | null;
  createdBy: string;
  deletedAt: string | null;
  retentionTier: "short" | "medium" | "long" | "none" | null;
  createdAt: string;
  updatedAt: string;
}
```

## Fields

| Field            | Type                                              | Notes                                                                                                                                        |
| ---------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`             | `string`                                          | `readonly` `required`                                                                                                                        |
| `workspaceId`    | `string`                                          | `required` — Workspace that owns this database.                                                                                              |
| `slug`           | `string`                                          | `required` — URL/code-friendly identifier scoped to the workspace.                                                                           |
| `name`           | `string`                                          | `required` — Human-readable database name.                                                                                                   |
| `description`    | `string \| null`                                  | `required` — Optional longer-form description.                                                                                               |
| `kind`           | `"d1"`                                            | `required` — Backend kind; currently only 'd1' (Cloudflare D1) is supported.                                                                 |
| `status`         | `"failed" \| "ready" \| "provisioning"`           | `required` — Provisioning state: 'provisioning' while being created, 'ready' when usable, 'failed' on error.                                 |
| `cfResourceId`   | `string \| null`                                  | `required` — Cloudflare resource ID for the underlying database, once provisioned.                                                           |
| `cfResourceName` | `string \| null`                                  | `required` — Cloudflare resource name for the underlying database.                                                                           |
| `createdBy`      | `string`                                          | `required` — User who created the database.                                                                                                  |
| `deletedAt`      | `string \| null`                                  | `required` — ISO-8601 timestamp of soft-delete; null while active. Cleanup worker hard-deletes once `deletedAt + retentionTier.days` passes. |
| `retentionTier`  | `"short" \| "medium" \| "long" \| "none" \| null` | `required` — Retention tier snapshotted at delete time. `short`=7d, `medium`=30d, `long`=90d, `none`=never. Null while active.               |
| `createdAt`      | `string`                                          | `readonly` `required` — ISO-8601 timestamp of creation.                                                                                      |
| `updatedAt`      | `string`                                          | `readonly` `required` — ISO-8601 timestamp of the last update.                                                                               |
