Skip to content

Files

Upload file bytes directly
client.files.create(FileCreateParams { file, xProjectID } params, RequestOptionsoptions?): SGPFile { id, created_at, created_by, 7 more }
POST/v5/files
Import files from cloud storage
client.files.importFromCloud(FileImportFromCloudParams { files, xProjectID } params, RequestOptionsoptions?): FileImportFromCloudResponse { results }
POST/v5/files/cloud_imports
List files
client.files.list(FileListParams { ending_before, filename, limit, 4 more } params?, RequestOptionsoptions?): CursorPage<SGPFile { id, created_at, created_by, 7 more } >
GET/v5/files
Update a file
client.files.update(stringfileID, FileUpdateParams { tags, xProjectID } params, RequestOptionsoptions?): SGPFile { id, created_at, created_by, 7 more }
PATCH/v5/files/{file_id}
Get file metadata
client.files.retrieve(stringfileID, FileRetrieveParams { xProjectID } params?, RequestOptionsoptions?): SGPFile { id, created_at, created_by, 7 more }
GET/v5/files/{file_id}
Delete a file
client.files.delete(stringfileID, FileDeleteParams { xProjectID } params?, RequestOptionsoptions?): FileDeleteResponse { id, deleted, object }
DELETE/v5/files/{file_id}
ModelsExpand Collapse
SGPFile { id, created_at, created_by, 7 more }
id: string

The unique identifier of the entity.

created_at: string

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

formatdate-time
created_by: Identity { id, type, object }

The identity that created the entity.

id: string
type: "user" | "service_account"
One of the following:
"user"
"service_account"
object?: "identity"
filename: string
md5_checksum: string
mime_type: string
size: number
duration_seconds?: number
object?: "file"
tags?: Record<string, unknown>
FileImportFromCloudResponse { results }
results: Array<Result>

Results for each file import attempt

file: SGPFile { id, created_at, created_by, 7 more } | _FailedFile { filename, mime_type, object }

The file object (full File for success, minimal _FailedFile for failures)

One of the following:
SGPFile { id, created_at, created_by, 7 more }
id: string

The unique identifier of the entity.

created_at: string

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

formatdate-time
created_by: Identity { id, type, object }

The identity that created the entity.

id: string
type: "user" | "service_account"
One of the following:
"user"
"service_account"
object?: "identity"
filename: string
md5_checksum: string
mime_type: string
size: number
duration_seconds?: number
object?: "file"
tags?: Record<string, unknown>
_FailedFile { filename, mime_type, object }

Minimal file representation for failed uploads containing only essential information.

filename: string

The original filename from the request

mime_type: string

The original MIME type from the request

object?: "failed_file"
status: "SUCCESS" | "FAILED_FILE_DOES_NOT_EXIST" | "FAILED_INVALID_PERMISSIONS" | "FAILED_UNKNOWN_ERROR"

The status of the upload attempt

One of the following:
"SUCCESS"
"FAILED_FILE_DOES_NOT_EXIST"
"FAILED_INVALID_PERMISSIONS"
"FAILED_UNKNOWN_ERROR"
FileDeleteResponse { id, deleted, object }
id: string
deleted: boolean
object?: "file"

FilesContent

Download file content
client.files.content.retrieve(stringfileID, ContentRetrieveParams { xProjectID } params?, RequestOptionsoptions?): ContentRetrieveResponse
GET/v5/files/{file_id}/content
ModelsExpand Collapse
ContentRetrieveResponse = unknown