Schema

The `Schema` entity.

Definition

TypeScript
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

FieldTypeNotes
idstringreadonly required
workspaceIdstring | nullrequired — Workspace that owns this schema; null for system schemas.
slugstringrequired — URL-friendly identifier scoped to the workspace.
namestringrequired — Human-readable schema name.
descriptionstring | nullrequired — Optional longer-form description.
definitionRecord<string, unknown>required — JSON Schema definition describing the shape of data.
systembooleanrequired — True for built-in system schemas that cannot be edited or deleted.
createdBystring | nullrequired — User who created the schema; null for system schemas.
deletedAtstring | nullrequired — ISO-8601 timestamp of soft-delete; null while active. Cleanup worker hard-deletes once deletedAt + retentionTier.days passes.
retentionTier"short" | "medium" | "long" | "none" | nullrequired — Retention tier snapshotted at delete time. short=7d, medium=30d, long=90d, none=never. Null while active.
createdAtstringreadonly required — ISO-8601 timestamp of creation.
updatedAtstringreadonly required — ISO-8601 timestamp of the last update.