Skip to content

Find Files

client.beta.retrieval.find(RetrievalFindParams { index_id, organization_id, project_id, 4 more } params, RequestOptionsoptions?): PaginatedCursorPost<RetrievalFindResponse { file_id, file_name } >
POST/api/v1/retrieval/files/find

Search for files by name.

ParametersExpand Collapse
params: RetrievalFindParams { index_id, organization_id, project_id, 4 more }
index_id: string

Body param: ID of the index to search within.

organization_id?: string | null

Query param

formatuuid
project_id?: string | null

Query param

formatuuid
file_name?: string | null

Body param: Exact file name to match.

file_name_contains?: string | null

Body param: Substring match on file name (case-insensitive).

page_size?: number | null

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.

page_token?: string | null

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

ReturnsExpand Collapse
RetrievalFindResponse { file_id, file_name }

A file returned by find.

file_id: string

ID of the file.

file_name: string

Display name of the file.

Find Files

import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const retrievalFindResponse of client.beta.retrieval.find({ index_id: 'idx-abc123' })) {
  console.log(retrievalFindResponse.file_id);
}
{
  "items": [
    {
      "file_id": "file_id",
      "file_name": "file_name"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
Returns Examples
{
  "items": [
    {
      "file_id": "file_id",
      "file_name": "file_name"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}