Files

FilesResource

Methods

create() ->
post/v5/files

Upload a file's bytes directly and create a file record.

Send the file as multipart/form-data in the file field; the request body carries the raw bytes, unlike cloud_imports which only references blobs that already exist in cloud storage. The upload is rejected if it exceeds 25 MB; larger or direct-to-storage uploads use a separate upload flow. Content is deduplicated by checksum and MIME type, so uploading bytes identical to an existing file reuses the already-stored object instead of storing a second copy. Returns the created file's metadata.

import_from_cloud() ->
post/v5/files/cloud_imports

Register files that already exist in cloud blob storage as file records, in one batch.

Unlike upload, this transfers no bytes: each entry references an existing object by its container/bucket, filepath, filename, and MIME type, and only a metadata record pointing at that object is created. Files are imported independently and the response reports a per-file status. The response is 200 when every import succeeds and 207 when results are mixed, with each result marked SUCCESS or a failure reason (file does not exist, invalid permissions, or unknown error). Failed entries carry only the submitted filename and MIME type rather than a full file record.

list() -> SyncCursorPage[]
get/v5/files

List the account's files with pagination.

Optionally filter by filename (case-insensitive partial match). Results are scoped to the files the caller is authorized to read. Files marked hidden (internal or service-owned artifacts) are excluded from this listing but remain retrievable by id. Returns file metadata only, not content.

update(, ) ->
patch/v5/files/{file_id}

Update a file's mutable metadata by id.

Only the file's tags can be modified; filename, content, size, and other attributes are immutable through this endpoint. The supplied tags replace the file's existing tags. Returns the updated file metadata.

Parameters
file_id: str
tags: Optional[Dict[str, ]]
Returns
id: str

The unique identifier of the entity.

created_at:
(format: date-time)

The date and time when the entity was created in ISO format.

created_by:

The identity that created the entity.

filename: str
md5_checksum: str
mime_type: str
size: int
duration_seconds: Optional[int]
object: Optional[Literal["file"]]
(default: "file")
tags: Optional[Dict[str, ]]
Request example
200Example
retrieve() ->
get/v5/files/{file_id}

Retrieve a single file's metadata by id.

Returns the file record (id, filename, MIME type, size, tags, and related fields) but not the file's bytes; use the content endpoint to download the bytes.

delete() ->
delete/v5/files/{file_id}

Delete a file by id, removing its database record.

This is a hard delete: the file's row is removed from the database, not soft-archived. The underlying stored object is deleted only when no other file record still references the same stored content (identical checksum and MIME type); when another record shares the blob, the blob is retained. If the id refers to an incomplete multipart upload placeholder, its staged parts are aborted instead. Returns a confirmation carrying the deleted file's id.

Domain types

class FileDeleteResponse: ...
class FileImportFromCloudResponse: ...
class SGPFile: ...
Files

Content

FilesResource.ContentResource

Methods

retrieve() ->
get/v5/files/{file_id}/content

Download the raw bytes of a file by id.

Streams the stored object's content back directly (not a redirect or signed URL), with the response Content-Type set to the file's stored MIME type. Use the metadata endpoint for size, filename, and other attributes.

Domain types