Skip to content

List Files

client.Files.List(ctx, query) (*PaginatedCursor[FileListResponse], error)
GET/api/v1/beta/files

List files with optional filtering and pagination.

Filter by file_name, file_ids, or external_file_id. Supports cursor-based pagination and custom ordering.

ParametersExpand Collapse
query FileListParams
Expand param.Field[[]string]optional

Fields to expand on each file.

ExternalFileID param.Field[string]optional

Filter by external file ID.

FileIDs param.Field[[]string]optional

Filter by specific file IDs.

FileName param.Field[string]optional

Filter by file name (exact match).

OrderBy param.Field[string]optional

A comma-separated list of fields to order by, sorted in ascending order. Use ‘field_name desc’ to specify descending order.

OrganizationID param.Field[string]optional
PageSize param.Field[int64]optional

The maximum number of items to return. Defaults to 50, maximum is 1000.

maximum1000
minimum1
PageToken param.Field[string]optional

A page token received from a previous list call. Provide this to retrieve the subsequent page.

ProjectID param.Field[string]optional
ReturnsExpand Collapse
type FileListResponse struct{…}

An uploaded file.

ID string

Unique file identifier

Name string

File name including extension

maxLength3000
minLength1
ProjectID string

Project this file belongs to

formatuuid
DownloadURL PresignedURLoptional

Schema for a presigned URL.

ExpiresAt Time

The time at which the presigned URL expires

formatdate-time
URL string

A presigned URL for IO operations against a private file

minLength1
formaturi
FormFields map[string, string]optional

Form fields for a presigned POST request

ExpiresAt Timeoptional

When the file expires and may be automatically removed. Null means no expiration.

formatdate-time
ExternalFileID stringoptional

Optional ID for correlating with an external system

FileType stringoptional

File extension (pdf, docx, png, etc.)

maxLength3000
minLength1
LastModifiedAt Timeoptional

When the file was last modified (ISO 8601)

formatdate-time
Purpose stringoptional

How the file will be used: user_data, parse, extract, classify, split, sheet, or agent_app

List Files

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/llamacloud-prod-go"
  "github.com/stainless-sdks/llamacloud-prod-go/option"
)

func main() {
  client := llamacloudprod.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Files.List(context.TODO(), llamacloudprod.FileListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "items": [
    {
      "id": "dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "name": "invoice.pdf",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "download_url": {
        "expires_at": "2019-12-27T18:11:19.117Z",
        "url": "https://example.com",
        "form_fields": {
          "foo": "string"
        }
      },
      "expires_at": "2019-12-27T18:11:19.117Z",
      "external_file_id": "ext-12345",
      "file_type": "pdf",
      "last_modified_at": "2019-12-27T18:11:19.117Z",
      "purpose": "parse"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
Returns Examples
{
  "items": [
    {
      "id": "dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "name": "invoice.pdf",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "download_url": {
        "expires_at": "2019-12-27T18:11:19.117Z",
        "url": "https://example.com",
        "form_fields": {
          "foo": "string"
        }
      },
      "expires_at": "2019-12-27T18:11:19.117Z",
      "external_file_id": "ext-12345",
      "file_type": "pdf",
      "last_modified_at": "2019-12-27T18:11:19.117Z",
      "purpose": "parse"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}