---
title: "CreateFileBody"
description: "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."
section: "Reference"
group: "Types"
order: 90
---

## Definition

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

## Fields

| Field                 | Type                  | Notes                                                                                                 |
| --------------------- | --------------------- | ----------------------------------------------------------------------------------------------------- |
| `workspaceId`         | `string`              | `required` — Workspace that will own the uploaded file.                                               |
| `name`                | `string`              | `required` — Filename to show in the UI.                                                              |
| `size`                | `number`              | `required` — Total bytes of the upload                                                                |
| `declaredContentType` | `string`              | `required` — Browser-provided MIME type. The server verifies this via file-type sniffing on complete. |
| `directoryId`         | `string \| undefined` | `optional` — Destination directory. Defaults to the workspace root directory.                         |
| `partSize`            | `number \| undefined` | `optional` — Part size in bytes. Defaults to 10 MB.                                                   |
