Skip to content

List files

client.file.list(FileListParams { limit, offset } query?, RequestOptionsoptions?): FileListResponse { data, object, totalCount }
GET/v1/files

Returns a paginated list of files in your workspace. 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.

Required scope: files:read

Rate limit category: Search

ParametersExpand Collapse
query: FileListParams { limit, offset }
limit?: number

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

minimum1
maximum9007199254740991
offset?: number

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

minimum0
maximum9007199254740991
ReturnsExpand Collapse
FileListResponse { data, object, totalCount }
data: Array<Data>

Array of file objects for the current page.

id: string

Unique identifier for the file.

completedAt: string | null

When the file upload was completed.

createdAt: string

When the file upload session was created.

expiresAt: string | null

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

filename: string

Original filename.

mimeType: string

MIME type of the file.

sizeBytes: number

File size in bytes.

minimum-9007199254740991
maximum9007199254740991
status: "PENDING" | "COMPLETED" | "CANCELLED" | "EXPIRED"

Current upload status of the file.

One of the following:
"PENDING"
"COMPLETED"
"CANCELLED"
"EXPIRED"
object: string

The object type, always "list".

totalCount: number

Total number of matching files.

minimum0
maximum9007199254740991

List files

import Lightfield from 'lightfield';

const client = new Lightfield({
  apiKey: 'My API Key',
});

const fileListResponse = await client.file.list();

console.log(fileListResponse.data);
{
  "data": [
    {
      "id": "id",
      "completedAt": "completedAt",
      "createdAt": "createdAt",
      "expiresAt": "expiresAt",
      "filename": "filename",
      "mimeType": "mimeType",
      "sizeBytes": -9007199254740991,
      "status": "PENDING"
    }
  ],
  "object": "object",
  "totalCount": 0
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "completedAt": "completedAt",
      "createdAt": "createdAt",
      "expiresAt": "expiresAt",
      "filename": "filename",
      "mimeType": "mimeType",
      "sizeBytes": -9007199254740991,
      "status": "PENDING"
    }
  ],
  "object": "object",
  "totalCount": 0
}