Skip to content

List files

client.File.List(ctx, query) (*FileListResponse, error)
GET/v1/files

Returns a paginated list of files in your workspace. Results are sorted by when the record was created in Lightfield (createdAt), newest first. Use offset and limit to paginate through results. See List endpoints for more information about pagination.

Omits files uploaded through the app and synced chat attachments — both are still retrievable by id. See File uploads for which document classes are listable versus retrievable-only.

Pass recordId to list that record’s Google Drive, OneDrive and SharePoint tree instead, folders included, ordered by kind, then title, then id. The tree is capped at 1000 rows and paged with after (the last id from the previous page), not offset. A cut-off tree sets truncated to true, and totalCount is then 1000 rather than the size of the tree. after must be an id from this tree. Pass parentId with recordId to list one folder’s children; that listing uses offset. parentId alone is rejected. Only a user can use these filters, and storage items stay out of the unfiltered list.

Required scope: files:read

Rate limit category: Search

ParametersExpand Collapse
query FileListParams
After param.Field[string]Optional

With recordId and no parentId, the file id of the last row on the previous page. The next page is the rows after that id in kind, title, id order.

Limit param.Field[int64]Optional

Maximum number of records to return. Defaults to 25, maximum 25.

minimum1
maximum9007199254740991
Offset param.Field[int64]Optional

Number of records to skip for pagination. Defaults to 0.

minimum0
maximum9007199254740991
ParentID param.Field[string]Optional

With recordId, the Drive folder whose children to list. Requires recordId.

RecordID param.Field[string]Optional

Public id of an account, contact, opportunity, or custom object (acc_, con_, opp_, or obj_). When set, the list is that record’s Google Drive, OneDrive and SharePoint tree instead of the workspace file list.

ReturnsExpand Collapse
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.

List files

package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  fileListResponse, err := client.File.List(context.TODO(), githubcomlightfldlightfieldgo.FileListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", fileListResponse.Data)
}
{
  "data": [
    {
      "id": "id",
      "completedAt": "completedAt",
      "createdAt": "createdAt",
      "expiresAt": "expiresAt",
      "filename": "filename",
      "kind": "file",
      "mimeType": "mimeType",
      "modifiedAt": "modifiedAt",
      "parentId": "parentId",
      "sizeBytes": -9007199254740991,
      "source": "googleDrive",
      "status": "PENDING",
      "webUrl": "webUrl"
    }
  ],
  "object": "object",
  "totalCount": 0,
  "truncated": true
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "completedAt": "completedAt",
      "createdAt": "createdAt",
      "expiresAt": "expiresAt",
      "filename": "filename",
      "kind": "file",
      "mimeType": "mimeType",
      "modifiedAt": "modifiedAt",
      "parentId": "parentId",
      "sizeBytes": -9007199254740991,
      "source": "googleDrive",
      "status": "PENDING",
      "webUrl": "webUrl"
    }
  ],
  "object": "object",
  "totalCount": 0,
  "truncated": true
}