CreateFileBody

Body for `POST /api/files` — initiate a multipart upload and create a file row in `uploading` state. The response returns the file id plus signed URLs for each part so the client can PUT bytes directly to R2.

Definition

TypeScript
interface CreateFileBody {
  workspaceId: string;
  name: string;
  size: number;
  declaredContentType: string;
  directoryId?: string | undefined;
  partSize?: number | undefined;
}

Fields

FieldTypeNotes
workspaceIdstringrequired — Workspace that will own the uploaded file.
namestringrequired — Filename to show in the UI.
sizenumberrequired — Total bytes of the upload
declaredContentTypestringrequired — Browser-provided MIME type. The server verifies this via file-type sniffing on complete.
directoryIdstring | undefinedoptional — Destination directory. Defaults to the workspace root directory.
partSizenumber | undefinedoptional — Part size in bytes. Defaults to 10 MB.