---
title: "Schema"
description: "The `Schema` entity."
section: "Reference"
group: "Types"
order: 181
---

## Definition

```ts
interface Schema {
  id: string;
  workspaceId: string | null;
  slug: string;
  name: string;
  description: string | null;
  definition: Record<string, unknown>;
  system: boolean;
  createdBy: string | null;
  deletedAt: string | null;
  retentionTier: "short" | "medium" | "long" | "none" | null;
  createdAt: string;
  updatedAt: string;
}
```

## Fields

| Field           | Type                                              | Notes                                                                                                                                        |
| --------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`            | `string`                                          | `readonly` `required`                                                                                                                        |
| `workspaceId`   | `string \| null`                                  | `required` — Workspace that owns this schema; null for system schemas.                                                                       |
| `slug`          | `string`                                          | `required` — URL-friendly identifier scoped to the workspace.                                                                                |
| `name`          | `string`                                          | `required` — Human-readable schema name.                                                                                                     |
| `description`   | `string \| null`                                  | `required` — Optional longer-form description.                                                                                               |
| `definition`    | `Record<string, unknown>`                         | `required` — JSON Schema definition describing the shape of data.                                                                            |
| `system`        | `boolean`                                         | `required` — True for built-in system schemas that cannot be edited or deleted.                                                              |
| `createdBy`     | `string \| null`                                  | `required` — User who created the schema; null for system schemas.                                                                           |
| `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.                                                                               |
