Skip to content

File

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

Properties

PropertyTypeRequiredDescription
contentTypestringrequiredThe media type, such as application/pdf.
sizeintegerrequiredThe size in bytes.
namestringThe file name it was uploaded with.
visibilitystringWho may read it: Owner, Customer, or Public. The default is Owner.
uploadUrlurlThe 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 File is an export of one Document: each rendering of a Document to a format, such as PDF, is stored as a File. exportOf, inverse exportsTo.

Verbs

  1. createCreates a File.
    POST /{namespace}/filesdoFile.created
  2. getReturns one File by id.
    GET /{namespace}/files/{id}readNo Event
  3. listReturns Files, newest first, one page at a time.
    GET /{namespace}/filesreadNo Event
  4. updateChanges the given properties of a File.
    PATCH /{namespace}/files/{id}doFile.updated
  5. deleteDeletes a File; its history is kept.
    DELETE /{namespace}/files/{id}doFile.deleted
  6. 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}/editdoFile.edited
  7. generateGenerate makes an image, video, speech or music File from a prompt and reference Files, and records how it was made.
    POST /{namespace}/files/generatedoFile.generated

Permissions

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

Operationowneradminmemberviewer
File.createYesYesYesNo
File.getYesYesYesYes
File.listYesYesYesYes
File.updateYesYesYesNo
File.deleteYesYesYesNo
File.editYesYesYesNo
File.generateYesYesYesNo

Call it

Text
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.