# File

URL: /business/nouns/file · Id: `noun:file`

> A File is the stored bytes of an upload or a rendering.

A File is the stored bytes of an upload or a rendering.

## Properties
| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `contentType` | `string` | Yes | The media type, such as `application/pdf`. |
| `size` | `integer` | Yes | The size in bytes. |
| `name` | `string` | No | The file name it was uploaded with. |
| `visibility` | `string` | No | Who may read it: `Owner`, `Customer`, or `Public`. The default is `Owner`. |
| `uploadUrl` | `url` | No | The signed URL to upload the bytes to, returned by `File.create`. |

## Object
```json
{
  "$id": "https://api.sb/tutorloop.com/files/file_1",
  "$type": "File",
  "contentType": "Example content type",
  "size": 1,
  "name": "TutorLoop",
  "visibility": "Owner",
  "uploadUrl": "https://tutorloop.com"
}
```

## Relationships
- <a id="rel-export-of"></a>A File **is an export of** one [Document](/business/nouns/document): each rendering of a [Document](/business/nouns/document) to a format, such as PDF, is stored as a File. `exportOf`, inverse [`exportsTo`](/business/nouns/document#rel-exports-to).

## Verbs
| Verb | Description | Subject | Event | Class |
| --- | --- | --- | --- | --- |
| [File.edit](/business/nouns/file/edit) | Edit makes a new File from an existing one by instruction, such as upscaling or animating a still, and leaves the source unchanged. | [Content Lead](/agents/marketing/content-lead) | [`File.edited`](/business/events/File.edited) | Two-way: `try`, `send`, `do` |
| [File.generate](/business/nouns/file/generate) | Generate makes an image, video, speech or music File from a prompt and reference Files, and records how it was made. | [Content Lead](/agents/marketing/content-lead) | [`File.generated`](/business/events/File.generated) | Two-way: `try`, `send`, `do` |
| <a id="create"></a>[File.create](/business/nouns/file/create) | Creates a File. Inherited from [Noun](/business/nouns/noun). | None. | `File.created` | Two-way: `try`, `send`, `do` |
| <a id="get"></a>[File.get](/business/nouns/file/get) | Returns one File by id. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="list"></a>[File.list](/business/nouns/file/list) | Returns Files, newest first, one page at a time. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="update"></a>[File.update](/business/nouns/file/update) | Changes the given properties of a File. Inherited from [Noun](/business/nouns/noun). | None. | `File.updated` | Two-way: `try`, `send`, `do` |
| <a id="delete"></a>[File.delete](/business/nouns/file/delete) | Deletes a File; its history is kept. Inherited from [Noun](/business/nouns/noun). | None. | `File.deleted` | One-way: `send`, `do` |

## Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.

| Operation | `owner` | `admin` | `member` | `viewer` |
| --- | --- | --- | --- | --- |
| `File.create` | Yes | Yes | Yes | No |
| `File.get` | Yes | Yes | Yes | Yes |
| `File.list` | Yes | Yes | Yes | Yes |
| `File.update` | Yes | Yes | Yes | No |
| `File.delete` | Yes | Yes | Yes | No |
| `File.edit` | Yes | Yes | Yes | No |
| `File.generate` | Yes | Yes | Yes | No |

## Call it

**Ask**

```text
Generate the latest file.
```

**API**

```bash
curl -X POST https://api.sb/patentpad.com/files/generate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind":"image","prompt":"Example prompt"}'
```

```json
{
  "api": "https://api.sb/patentpad.com",
  "file": {
    "$id": "https://api.sb/patentpad.com/files/file_1",
    "$type": "File",
    "contentType": "Example content type",
    "size": 1
  },
  "action": {
    "$id": "https://api.sb/patentpad.com/actions/action_1",
    "operation": "File.generate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/patentpad.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const file = await $.File.generate({ kind: 'image', prompt: 'Example prompt' })
```

**CLI**

```bash
npx startup-builder do File.generate --json '{"kind":"image","prompt":"Example prompt"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.File.generate({ kind: 'image', prompt: 'Example prompt' })"
  }
}
```

## Example
A recruiting agency uploads `candidates.csv`: 40,000 rows, 18 MB. The File holds those bytes, and the import report it gets back is a second File, the PDF export of a [Document](/business/nouns/document).