File
A File is the stored bytes of an upload or a rendering.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
contentType | string | required | The media type, such as application/. |
size | integer | required | The size in bytes. |
name | string | The file name it was uploaded with. | |
visibility | string | Who may read it: Owner, Customer, or Public. The default is Owner. | |
uploadUrl | url | The signed URL to upload the bytes to, returned by File.create. |
Object
{
"$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 File is an export of one Document: each rendering of a Document to a format, such as PDF, is stored as a File.
exportOf, inverseexportsTo.
Verbs
createCreates a File.POST /{namespace}/filesgetReturns one File by id.GET /{namespace}/files/{id}listReturns Files, newest first, one page at a time.GET /{namespace}/filesupdateChanges the given properties of a File.PATCH /{namespace}/files/{id}deleteDeletes a File; its history is kept.DELETE /{namespace}/files/{id}editEdit makes a new File from an existing one by instruction, such as upscaling or animating a still, and leaves the source unchanged.POST /{namespace}/files/{file}/editgenerateGenerate makes an image, video, speech or music File from a prompt and reference Files, and records how it was made.POST /{namespace}/files/generate
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
Generate the latest file.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.