Skip to content

Query Files

Deprecated
client.Files.Query(ctx, params) (*FileQueryResponse, error)
POST/api/v1/beta/files/query

Query files with flexible filtering and pagination.

Deprecated: Use GET /files instead for listing files with query parameters.

Args: request: The query request with filters and pagination project: Validated project from dependency

Returns: Paginated response with files

ParametersExpand Collapse
params FileQueryParams
OrganizationID param.Field[string]optional

Query param

formatuuid
ProjectID param.Field[string]optional

Query param

formatuuid
Filter param.Field[FileQueryParamsFilter]optional

Body param: Filter parameters for file queries.

DataSourceID stringoptional

Filter by data source ID

formatuuid
ExternalFileID stringoptional

Filter by external file ID

FileIDs []stringoptional

Filter by specific file IDs

FileName stringoptional

Filter by file name

OnlyManuallyUploaded booloptional

Filter only manually uploaded files (data_source_id is null)

ProjectID stringoptional

Filter by project ID

formatuuid
OrderBy param.Field[string]optional

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

PageSize param.Field[int64]optional

Body param: The maximum number of items to return. The service may return fewer than this value. If unspecified, a default page size will be used. The maximum value is typically 1000; values above this will be coerced to the maximum.

PageToken param.Field[string]optional

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

ReturnsExpand Collapse
type FileQueryResponse struct{…}

Paginated list of files.

Items []FileQueryResponseItem

The list of items.

ID string

Unique file identifier

Name string

File name including extension

maxLength3000
minLength1
ProjectID string

Project this file belongs to

formatuuid
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

NextPageToken stringoptional

A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

TotalSize int64optional

The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only.

Query 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"),
  )
  response, err := client.Files.Query(context.TODO(), llamacloudprod.FileQueryParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Items)
}
{
  "items": [
    {
      "id": "dfl-aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "name": "invoice.pdf",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "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",
      "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
}