File

File — unified content entity. Every piece of user content (document, image, video, anything) is a file row. Image and video specializations live in side tables and are surfaced via the filtered image/video convenience endpoints. Multipart upload state is inline on the file row (`r2MultipartId`, `parts`, etc.) and null once `status = "ready"`.

Definition

TypeScript
interface File {
  id: string;
  workspaceId: string;
  directoryId: string;
  name: string;
  mime: string | null;
  size: number | null;
  status: "error" | "ready" | "uploading";
  errorMessage: string | null;
  metadata: any;
  createdBy: string | null;
  createdAt: string;
  updatedAt: string;
  finalizedAt: string | null;
  expiresAt: string | null;
}

Fields

FieldTypeNotes
idstringreadonly required
workspaceIdstringrequired — Workspace that owns this file.
directoryIdstringrequired — Directory containing this file in the DB hierarchy.
namestringrequired — Filename as shown to the user.
mimestring | nullrequired — Verified MIME type of the file; null until the upload is finalized.
sizenumber | nullrequired — File size in bytes; null until the upload is finalized.
status"error" | "ready" | "uploading"required — Lifecycle state: 'uploading', 'ready', or 'error'.
errorMessagestring | nullrequired — Error message when status is 'error', otherwise null.
metadataanyrequired — Free-form metadata (EXIF, duration, dimensions, etc.).
createdBystring | nullrequired — User who created the file; null for system-generated files.
createdAtstringreadonly required — ISO-8601 timestamp of creation.
updatedAtstringreadonly required — ISO-8601 timestamp of the last update.
finalizedAtstring | nullrequired — ISO-8601 timestamp when the upload was completed.
expiresAtstring | nullrequired — Optional TTL. Once past this timestamp the file (DB row + R2 object) is garbage-collected by the cleanup worker. Null = permanent.