Skip to content

File

Files are used to upload documents via presigned URLs. After uploading and completing a file, link it to resources through their own APIs (e.g. attach a transcript to a meeting). See File uploads for the full upload flow and supported purposes. For meeting transcript attachments, see Uploading meeting transcripts. Not every retrievable file is listable: files uploaded through the app and synced chat attachments are fetchable by id (GET /v1/files/{id}, GET /v1/files/{id}/url, or a CRM record’s $files relationship) but never appear in GET /v1/files.

Create a file upload session
client.File.New(ctx, body) (*FileCreateResponse, error)
POST/v1/files
Import a file from Google Drive, OneDrive or SharePoint
client.File.NewFromStorage(ctx, body) (*FileCreateFromStorageResponse, error)
POST/v1/files/import
Complete a file upload
client.File.Complete(ctx, id, body) (*FileCompleteResponse, error)
POST/v1/files/{id}/complete
Retrieve a file
client.File.Get(ctx, id) (*FileRetrieveResponse, error)
GET/v1/files/{id}
List files
client.File.List(ctx, query) (*FileListResponse, error)
GET/v1/files
Get a file download URL
client.File.URL(ctx, id) (*FileURLResponse, error)
GET/v1/files/{id}/url
Cancel a file upload
client.File.Cancel(ctx, id, body) (*FileCancelResponse, error)
POST/v1/files/{id}/cancel
ModelsExpand Collapse
type FileCancelResponse struct{…}
ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind FileCancelResponseKind

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileCancelResponseKindFile FileCancelResponseKind = "file"
const FileCancelResponseKindFolder FileCancelResponseKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source FileCancelResponseSource

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileCancelResponseSourceGoogleDrive FileCancelResponseSource = "googleDrive"
const FileCancelResponseSourceMicrosoftDrive FileCancelResponseSource = "microsoftDrive"
Status FileCancelResponseStatus

Current upload status of the file.

One of the following:
const FileCancelResponseStatusPending FileCancelResponseStatus = "PENDING"
const FileCancelResponseStatusCompleted FileCancelResponseStatus = "COMPLETED"
const FileCancelResponseStatusCancelled FileCancelResponseStatus = "CANCELLED"
const FileCancelResponseStatusExpired FileCancelResponseStatus = "EXPIRED"
WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

type FileCompleteResponse struct{…}
ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind FileCompleteResponseKind

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileCompleteResponseKindFile FileCompleteResponseKind = "file"
const FileCompleteResponseKindFolder FileCompleteResponseKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source FileCompleteResponseSource

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileCompleteResponseSourceGoogleDrive FileCompleteResponseSource = "googleDrive"
const FileCompleteResponseSourceMicrosoftDrive FileCompleteResponseSource = "microsoftDrive"
Status FileCompleteResponseStatus

Current upload status of the file.

One of the following:
const FileCompleteResponseStatusPending FileCompleteResponseStatus = "PENDING"
const FileCompleteResponseStatusCompleted FileCompleteResponseStatus = "COMPLETED"
const FileCompleteResponseStatusCancelled FileCompleteResponseStatus = "CANCELLED"
const FileCompleteResponseStatusExpired FileCompleteResponseStatus = "EXPIRED"
WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

type FileCreateFromStorageResponse struct{…}
ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind FileCreateFromStorageResponseKind

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileCreateFromStorageResponseKindFile FileCreateFromStorageResponseKind = "file"
const FileCreateFromStorageResponseKindFolder FileCreateFromStorageResponseKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source FileCreateFromStorageResponseSource

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileCreateFromStorageResponseSourceGoogleDrive FileCreateFromStorageResponseSource = "googleDrive"
const FileCreateFromStorageResponseSourceMicrosoftDrive FileCreateFromStorageResponseSource = "microsoftDrive"
Status FileCreateFromStorageResponseStatus

Current upload status of the file.

One of the following:
const FileCreateFromStorageResponseStatusPending FileCreateFromStorageResponseStatus = "PENDING"
const FileCreateFromStorageResponseStatusCompleted FileCreateFromStorageResponseStatus = "COMPLETED"
const FileCreateFromStorageResponseStatusCancelled FileCreateFromStorageResponseStatus = "CANCELLED"
const FileCreateFromStorageResponseStatusExpired FileCreateFromStorageResponseStatus = "EXPIRED"
WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

type FileCreateResponse struct{…}
ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind FileCreateResponseKind

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileCreateResponseKindFile FileCreateResponseKind = "file"
const FileCreateResponseKindFolder FileCreateResponseKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source FileCreateResponseSource

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileCreateResponseSourceGoogleDrive FileCreateResponseSource = "googleDrive"
const FileCreateResponseSourceMicrosoftDrive FileCreateResponseSource = "microsoftDrive"
Status FileCreateResponseStatus

Current upload status of the file.

One of the following:
const FileCreateResponseStatusPending FileCreateResponseStatus = "PENDING"
const FileCreateResponseStatusCompleted FileCreateResponseStatus = "COMPLETED"
const FileCreateResponseStatusCancelled FileCreateResponseStatus = "CANCELLED"
const FileCreateResponseStatusExpired FileCreateResponseStatus = "EXPIRED"
UploadHeaders map[string, string]

Headers to include in the upload request.

UploadURL string

Upload URL. Upload the file bytes directly to this URL.

WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

type FileListResponse struct{…}
Data []FileListResponseData

Array of file objects for the current page.

ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind string

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileListResponseDataKindFile FileListResponseDataKind = "file"
const FileListResponseDataKindFolder FileListResponseDataKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source string

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileListResponseDataSourceGoogleDrive FileListResponseDataSource = "googleDrive"
const FileListResponseDataSourceMicrosoftDrive FileListResponseDataSource = "microsoftDrive"
Status string

Current upload status of the file.

One of the following:
const FileListResponseDataStatusPending FileListResponseDataStatus = "PENDING"
const FileListResponseDataStatusCompleted FileListResponseDataStatus = "COMPLETED"
const FileListResponseDataStatusCancelled FileListResponseDataStatus = "CANCELLED"
const FileListResponseDataStatusExpired FileListResponseDataStatus = "EXPIRED"
WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

Object string

The object type, always "list".

TotalCount int64

Total number of matching files.

minimum0
maximum9007199254740991
Truncated boolOptional

Present and true when a Drive tree was cut off at 1000 rows. totalCount is then the cap, not the size of the tree.

type FileRetrieveResponse struct{…}
ID string

Unique identifier for the file.

CompletedAt string

When the file upload was completed.

CreatedAt string

When the file upload session was created.

ExpiresAt string

When the upload session expires. Null once completed, cancelled, or expired.

Filename string

Original filename.

Kind FileRetrieveResponseKind

Whether the item is a file or a folder. Null when the response was built without that column.

One of the following:
const FileRetrieveResponseKindFile FileRetrieveResponseKind = "file"
const FileRetrieveResponseKindFolder FileRetrieveResponseKind = "folder"
MimeType string

MIME type of the file.

ModifiedAt string

When the storage last modified this item. Null for a non-storage file, and for a storage item whose modified time has not been stored.

ParentID string

The storage folder this item sits in, or null for a top-level item or a non-storage file.

SizeBytes int64

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
Source FileRetrieveResponseSource

Where the file came from. googleDrive for a linked Google Drive item, microsoftDrive for a linked OneDrive or SharePoint item. Null for every other file.

One of the following:
const FileRetrieveResponseSourceGoogleDrive FileRetrieveResponseSource = "googleDrive"
const FileRetrieveResponseSourceMicrosoftDrive FileRetrieveResponseSource = "microsoftDrive"
Status FileRetrieveResponseStatus

Current upload status of the file.

One of the following:
const FileRetrieveResponseStatusPending FileRetrieveResponseStatus = "PENDING"
const FileRetrieveResponseStatusCompleted FileRetrieveResponseStatus = "COMPLETED"
const FileRetrieveResponseStatusCancelled FileRetrieveResponseStatus = "CANCELLED"
const FileRetrieveResponseStatusExpired FileRetrieveResponseStatus = "EXPIRED"
WebURL string

A link that opens this item in Google Drive, OneDrive or SharePoint. Null for a non-storage file.

type FileURLResponse struct{…}
ExpiresAt string

When the download URL expires.

URL string

Temporary download URL for the file.