# Beta

# Indexes

## Get Index

`client.beta.indexes.get(stringindexID, IndexGetParamsquery?, RequestOptionsoptions?): IndexGetResponse`

**get** `/api/v1/indexes/{index_id}`

Get an index by ID.

### Parameters

- `indexID: string`

- `query: IndexGetParams`

  - `expand?: Array<"sync_in_progress">`

    Fields to expand. Supported value: sync_in_progress.

    - `"sync_in_progress"`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `IndexGetResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const index = await client.beta.indexes.get('index_id');

console.log(index.id);
```

#### Response

```json
{
  "id": "id",
  "export_config_id": "export_config_id",
  "name": "name",
  "output_directory_id": "output_directory_id",
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "sync_config_id": "sync_config_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "last_exported_at": "2019-12-27T18:11:19.117Z",
  "last_synced_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "sync_in_progress": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Index

`client.beta.indexes.delete(stringindexID, IndexDeleteParamsparams?, RequestOptionsoptions?): void`

**delete** `/api/v1/indexes/{index_id}`

Delete an index.

### Parameters

- `indexID: string`

- `params: IndexDeleteParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Example

```typescript
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
});

await client.beta.indexes.delete('index_id');
```

## Create Index

`client.beta.indexes.create(IndexCreateParamsparams, RequestOptionsoptions?): IndexCreateResponse`

**post** `/api/v1/indexes`

Create a searchable index over a source directory.

### Parameters

- `params: IndexCreateParams`

  - `source_directory_id: string`

    Body param: ID of the source directory containing your documents.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `description?: string | null`

    Body param: Optional description of the index.

  - `name?: string | null`

    Body param: Optional display name for the index. If omitted, the index is named after the source directory.

  - `products?: Array<Product> | null`

    Body param: Product configurations for syncing. Omit to use a default parse configuration. Include an explicit entry per product type (e.g. parse, extract) to override the default.

    - `product_config_id: string`

      ID of the product configuration.

    - `product_type: string`

      Product type. One of: parse, extract.

  - `store_attachments?: Array<string> | null`

    Body param: Attachment kinds to store alongside parsed output. Each entry must be one of: screenshots, items. For example, ['screenshots'] renders and stores per-page screenshots; ['items'] stores structured items with bounding boxes. Omit or pass an empty list to skip attachments.

  - `sync_frequency?: string`

    Body param: How often to re-run the sync. One of: manual, daily, on_source_change. Defaults to manual.

  - `vector_target?: "DEFAULT" | "DISABLED"`

    Body param: Vector export destination for the index. 'DEFAULT' exports to the managed vector DB destination resolved from configuration. 'DISABLED' skips vector export — the export destination falls back to 'Download'.

    - `"DEFAULT"`

    - `"DISABLED"`

### Returns

- `IndexCreateResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const index = await client.beta.indexes.create({ source_directory_id: 'dir-abc123' });

console.log(index.id);
```

#### Response

```json
{
  "id": "id",
  "export_config_id": "export_config_id",
  "name": "name",
  "output_directory_id": "output_directory_id",
  "project_id": "project_id",
  "source_directory_id": "source_directory_id",
  "sync_config_id": "sync_config_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "last_exported_at": "2019-12-27T18:11:19.117Z",
  "last_synced_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "sync_in_progress": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Sync Index

`client.beta.indexes.sync(stringindexID, IndexSyncParamsparams?, RequestOptionsoptions?): IndexSyncResponse`

**post** `/api/v1/indexes/{index_id}/sync`

Trigger a sync and export for an existing index, re-parsing changed files and exporting updated chunks.

### Parameters

- `indexID: string`

- `params: IndexSyncParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `IndexSyncResponse = unknown`

### Example

```typescript
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
});

const response = await client.beta.indexes.sync('index_id');

console.log(response);
```

#### Response

```json
{}
```

## List Indexes

`client.beta.indexes.list(IndexListParamsquery?, RequestOptionsoptions?): PaginatedCursor<IndexListResponse>`

**get** `/api/v1/indexes`

List indexes for the current project.

### Parameters

- `query: IndexListParams`

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

  - `source_directory_id?: string | null`

### Returns

- `IndexListResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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 indexListResponse of client.beta.indexes.list()) {
  console.log(indexListResponse.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "export_config_id": "export_config_id",
      "name": "name",
      "output_directory_id": "output_directory_id",
      "project_id": "project_id",
      "source_directory_id": "source_directory_id",
      "sync_config_id": "sync_config_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "last_exported_at": "2019-12-27T18:11:19.117Z",
      "last_synced_at": "2019-12-27T18:11:19.117Z",
      "metadata": {
        "foo": "bar"
      },
      "sync_in_progress": true,
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Domain Types

### Index Get Response

- `IndexGetResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

### Index Create Response

- `IndexCreateResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

### Index Sync Response

- `IndexSyncResponse = unknown`

### Index List Response

- `IndexListResponse`

  A searchable index over a directory of documents.

  - `id: string`

    Unique identifier

  - `export_config_id: string`

    ID of the export configuration.

  - `name: string`

    Index name.

  - `output_directory_id: string`

    ID of the output directory holding the indexed files.

  - `project_id: string`

    Project this index belongs to.

  - `source_directory_id: string`

    ID of the source directory.

  - `sync_config_id: string`

    ID of the sync configuration.

  - `created_at?: string | null`

    Creation datetime

  - `description?: string | null`

    Index description.

  - `last_exported_at?: string | null`

    Last export time.

  - `last_synced_at?: string | null`

    Last sync time.

  - `metadata?: Record<string, unknown>`

    Build state and diagnostic info.

  - `sync_in_progress?: boolean | null`

    Whether the index is syncing its source or exporting the result. Requires `expand=sync_in_progress`.

  - `updated_at?: string | null`

    Update datetime

# Retrieval

## Retrieve

`client.beta.retrieval.retrieve(RetrievalRetrieveParamsparams, RequestOptionsoptions?): RetrievalRetrieveResponse`

**post** `/api/v1/retrieval/retrieve`

Retrieve relevant chunks via hybrid search (vector + full-text), with filtering on built-in or user-defined metadata.

### Parameters

- `params: RetrievalRetrieveParams`

  - `index_id: string`

    Body param: ID of the index to retrieve against.

  - `query: string`

    Body param: Natural-language query to retrieve relevant chunks.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `custom_filters?: Record<string, ValueFilter | Array<UnionMember1> | null> | null`

    Body param: Filters on user-defined metadata fields.

    - `ValueFilter`

      Filter on a single metadata field value.

      - `operator: "eq" | "gt" | "gte" | 5 more`

        - `"eq"`

        - `"gt"`

        - `"gte"`

        - `"in"`

        - `"lt"`

        - `"lte"`

        - `"ne"`

        - `"nin"`

      - `value: string | boolean | number | Array<string | boolean | number>`

        - `string`

        - `boolean`

        - `number`

        - `Array<string | boolean | number>`

          - `string`

          - `boolean`

          - `number`

    - `Array<UnionMember1>`

      - `operator: "eq" | "gt" | "gte" | 5 more`

        - `"eq"`

        - `"gt"`

        - `"gte"`

        - `"in"`

        - `"lt"`

        - `"lte"`

        - `"ne"`

        - `"nin"`

      - `value: number | Array<number>`

        - `number`

        - `Array<number>`

  - `full_text_pipeline_weight?: number | null`

    Body param: Weight of the full-text search pipeline (0-1).

  - `num_candidates?: number | null`

    Body param: Number of candidates for approximate nearest neighbor search.

  - `rerank?: Rerank`

    Body param: Reranking configuration applied after hybrid search. Enabled by default.

    - `enabled?: boolean`

      Set to false to disable reranking.

    - `top_n?: number | null`

      Number of results to return after reranking.

  - `score_threshold?: number | null`

    Body param: Minimum score threshold for returned results.

  - `static_filters?: StaticFilters | null`

    Body param: Filters on built-in document fields (page range, chunk index, etc.).

    - `parsed_directory_file_id?: ParsedDirectoryFileID | null`

      Filter on a string field.

      - `operator: "eq" | "gt" | "gte" | 5 more`

        - `"eq"`

        - `"gt"`

        - `"gte"`

        - `"in"`

        - `"lt"`

        - `"lte"`

        - `"ne"`

        - `"nin"`

      - `value: string | Array<string>`

        - `string`

        - `Array<string>`

  - `top_k?: number | null`

    Body param: Maximum number of results to return. Values above 500 are capped at 500.

  - `vector_pipeline_weight?: number | null`

    Body param: Weight of the vector search pipeline (0-1).

### Returns

- `RetrievalRetrieveResponse`

  Response containing retrieval results.

  - `results: Array<Result>`

    Ordered list of retrieved chunks.

    - `content: string`

      Text content of the retrieved chunk.

    - `metadata?: Record<string, string | number | number | 3 more> | null`

      User-defined metadata associated with the chunk.

      - `string`

      - `number`

      - `number`

      - `boolean`

      - `unknown`

      - `Array<string>`

    - `rerank_score?: number | null`

      Relevance score from the reranker, if reranking was applied.

    - `score?: number | null`

      Hybrid search relevance score.

    - `static_fields?: StaticFields`

      Built-in fields stored for every exported chunk.

      - `attachments?: Array<Attachment>`

        Attachments associated with the chunk

        - `attachment_name: string`

          Attachment-relative path, e.g. 'screenshots/page_7.jpg'.

        - `source_id: string`

          File ID to pass as source_id when fetching the attachment.

        - `type: string`

          Attachment kind, e.g. 'screenshot', 'items'.

      - `chunk_end_char?: number | null`

        End character offset of the chunk.

      - `chunk_index?: number | null`

        Index of the chunk within the file.

      - `chunk_start_char?: number | null`

        Start character offset of the chunk.

      - `chunk_token_count?: number | null`

        Token count of the chunk.

      - `page_range_end?: number | null`

        Last page number covered by this chunk.

      - `page_range_start?: number | null`

        First page number covered by this chunk.

      - `parsed_directory_file_id?: string | null`

        ID of the parsed file.

### Example

```typescript
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
});

const retrieval = await client.beta.retrieval.retrieve({
  index_id: 'idx-abc123',
  query: 'What are the key findings?',
});

console.log(retrieval.results);
```

#### Response

```json
{
  "results": [
    {
      "content": "content",
      "metadata": {
        "foo": "string"
      },
      "rerank_score": 0,
      "score": 0,
      "static_fields": {
        "attachments": [
          {
            "attachment_name": "attachment_name",
            "source_id": "source_id",
            "type": "type"
          }
        ],
        "chunk_end_char": 0,
        "chunk_index": 0,
        "chunk_start_char": 0,
        "chunk_token_count": 0,
        "page_range_end": 0,
        "page_range_start": 0,
        "parsed_directory_file_id": "parsed_directory_file_id"
      }
    }
  ]
}
```

## Find Files

`client.beta.retrieval.find(RetrievalFindParamsparams, RequestOptionsoptions?): PaginatedCursorPost<RetrievalFindResponse>`

**post** `/api/v1/retrieval/files/find`

Search for files by name.

### Parameters

- `params: RetrievalFindParams`

  - `index_id: string`

    Body param: ID of the index to search within.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `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.

### Returns

- `RetrievalFindResponse`

  A file returned by find.

  - `file_id: string`

    ID of the file.

  - `file_name: string`

    Display name of the file.

### Example

```typescript
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);
}
```

#### Response

```json
{
  "items": [
    {
      "file_id": "file_id",
      "file_name": "file_name"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Grep File

`client.beta.retrieval.grep(RetrievalGrepParamsparams, RequestOptionsoptions?): PaginatedCursorPost<RetrievalGrepResponse>`

**post** `/api/v1/retrieval/files/grep`

Grep within a file's parsed content using a regex pattern.

### Parameters

- `params: RetrievalGrepParams`

  - `file_id: string`

    Body param: ID of the file to grep.

  - `index_id: string`

    Body param: ID of the index the file belongs to.

  - `pattern: string`

    Body param: Regex pattern to search for.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `context_chars?: number | null`

    Body param: Number of characters of context to include before and after the matched pattern in the content field of the response

  - `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.

### Returns

- `RetrievalGrepResponse`

  A single grep match within a file.

  - `content: string`

    Matched text content.

  - `end_char: number`

    End character offset of the match.

  - `start_char: number`

    Start character offset of the match.

### Example

```typescript
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 retrievalGrepResponse of client.beta.retrieval.grep({
  file_id: 'file_id',
  index_id: 'idx-abc123',
  pattern: 'revenue|profit',
})) {
  console.log(retrievalGrepResponse.content);
}
```

#### Response

```json
{
  "items": [
    {
      "content": "content",
      "end_char": 0,
      "start_char": 0
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Read File

`client.beta.retrieval.read(RetrievalReadParamsparams, RequestOptionsoptions?): RetrievalReadResponse`

**post** `/api/v1/retrieval/files/read`

Read the parsed text content of a specific file.

### Parameters

- `params: RetrievalReadParams`

  - `file_id: string`

    Body param: ID of the file to read.

  - `index_id: string`

    Body param: ID of the index the file belongs to.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `max_length?: number | null`

    Body param: Maximum number of characters to read from the offset.

  - `offset?: number`

    Body param: Starting character offset.

### Returns

- `RetrievalReadResponse`

  File read result.

  - `content: string`

    Parsed text content of the file.

### Example

```typescript
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
});

const response = await client.beta.retrieval.read({ file_id: 'file_id', index_id: 'idx-abc123' });

console.log(response.content);
```

#### Response

```json
{
  "content": "content"
}
```

## Domain Types

### Retrieval Retrieve Response

- `RetrievalRetrieveResponse`

  Response containing retrieval results.

  - `results: Array<Result>`

    Ordered list of retrieved chunks.

    - `content: string`

      Text content of the retrieved chunk.

    - `metadata?: Record<string, string | number | number | 3 more> | null`

      User-defined metadata associated with the chunk.

      - `string`

      - `number`

      - `number`

      - `boolean`

      - `unknown`

      - `Array<string>`

    - `rerank_score?: number | null`

      Relevance score from the reranker, if reranking was applied.

    - `score?: number | null`

      Hybrid search relevance score.

    - `static_fields?: StaticFields`

      Built-in fields stored for every exported chunk.

      - `attachments?: Array<Attachment>`

        Attachments associated with the chunk

        - `attachment_name: string`

          Attachment-relative path, e.g. 'screenshots/page_7.jpg'.

        - `source_id: string`

          File ID to pass as source_id when fetching the attachment.

        - `type: string`

          Attachment kind, e.g. 'screenshot', 'items'.

      - `chunk_end_char?: number | null`

        End character offset of the chunk.

      - `chunk_index?: number | null`

        Index of the chunk within the file.

      - `chunk_start_char?: number | null`

        Start character offset of the chunk.

      - `chunk_token_count?: number | null`

        Token count of the chunk.

      - `page_range_end?: number | null`

        Last page number covered by this chunk.

      - `page_range_start?: number | null`

        First page number covered by this chunk.

      - `parsed_directory_file_id?: string | null`

        ID of the parsed file.

### Retrieval Find Response

- `RetrievalFindResponse`

  A file returned by find.

  - `file_id: string`

    ID of the file.

  - `file_name: string`

    Display name of the file.

### Retrieval Grep Response

- `RetrievalGrepResponse`

  A single grep match within a file.

  - `content: string`

    Matched text content.

  - `end_char: number`

    End character offset of the match.

  - `start_char: number`

    Start character offset of the match.

### Retrieval Read Response

- `RetrievalReadResponse`

  File read result.

  - `content: string`

    Parsed text content of the file.

# Chat

## List Sessions

`client.beta.chat.list(ChatListParamsquery?, RequestOptionsoptions?): PaginatedCursor<ChatListResponse>`

**get** `/api/v1/chat`

List all chat sessions for the current project.

### Parameters

- `query: ChatListParams`

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

### Returns

- `ChatListResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Example

```typescript
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 chatListResponse of client.beta.chat.list()) {
  console.log(chatListResponse.session_id);
}
```

#### Response

```json
{
  "items": [
    {
      "last_updated_at": "2026-04-22T12:34:41.342245",
      "session_id": "ses-abc123",
      "shared_access": "read_only",
      "generated_title": "What were the main findings in Q3?...",
      "index_ids": [
        "idx-abc123",
        "idx-def456"
      ],
      "job_metadata": {
        "duration_ms": 0,
        "error": "error",
        "export_config_ids": [
          "string"
        ],
        "is_error": true,
        "total_input_tokens": 0,
        "total_output_tokens": 0,
        "turns": 0
      }
    }
  ],
  "next_page_token": "next_page_token"
}
```

## Create Session

`client.beta.chat.create(ChatCreateParamsparams?, RequestOptionsoptions?): ChatCreateResponse`

**post** `/api/v1/chat`

Create a chat session, optionally bound to indexes (locked after the first message).

### Parameters

- `params: ChatCreateParams`

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `index_ids?: Array<string> | null`

    Body param: Indexes this session will retrieve from. Once set and the first message has been sent, the source set is locked for the session's lifetime. Leave null to create an unbound session.

  - `shared_access?: "query" | "read_only" | null`

    Body param: What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions). Null follows the deployment default.

    - `"query"`

    - `"read_only"`

### Returns

- `ChatCreateResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Example

```typescript
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
});

const chat = await client.beta.chat.create();

console.log(chat.session_id);
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Get Full Session

`client.beta.chat.retrieve(stringsessionID, ChatRetrieveParamsquery?, RequestOptionsoptions?): ChatRetrieveResponse`

**get** `/api/v1/chat/{session_id}`

Retrieve a full session by ID, including its event history.

### Parameters

- `sessionID: string`

- `query: ChatRetrieveParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `ChatRetrieveResponse`

  Full chat session including its complete event history.

  - `events: Array<StopEvent | TextDeltaEvent | TextEvent | 5 more>`

    Ordered list of events that make up the conversation history.

    - `StopEvent`

      - `error: string | null`

      - `is_error: boolean`

      - `usage: Usage`

        - `duration_ms?: number`

        - `total_input_tokens?: number | null`

        - `total_output_tokens?: number | null`

        - `turns?: number`

      - `skipped_index_ids?: Array<string>`

        Requested indexes this turn could not query.

      - `type?: "stop"`

        - `"stop"`

    - `TextDeltaEvent`

      - `content: string`

      - `type?: "text_delta"`

        - `"text_delta"`

    - `TextEvent`

      - `content: string`

      - `type?: "text"`

        - `"text"`

    - `ThinkingDeltaEvent`

      - `content: string`

      - `type?: "thinking_delta"`

        - `"thinking_delta"`

    - `ThinkingEvent`

      - `content: string`

      - `type?: "thinking"`

        - `"thinking"`

    - `ToolCallEvent`

      - `arguments: Record<string, unknown>`

      - `call_id: string`

      - `name: string`

      - `type?: "tool_call"`

        - `"tool_call"`

    - `ToolResultEvent`

      - `call_id: string`

      - `name: string`

      - `result: unknown`

      - `image_attachment?: ImageAttachment | null`

        Coordinates for lazily resolving a page screenshot presigned URL.

        - `attachment_name: string`

        - `source_id: string`

      - `type?: "tool_result"`

        - `"tool_result"`

    - `UserInputEvent`

      - `content: string`

      - `type?: "user_input"`

        - `"user_input"`

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Example

```typescript
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
});

const chat = await client.beta.chat.retrieve('session_id');

console.log(chat.session_id);
```

#### Response

```json
{
  "events": [
    {
      "error": "error",
      "is_error": true,
      "usage": {
        "duration_ms": 0,
        "total_input_tokens": 0,
        "total_output_tokens": 0,
        "turns": 0
      },
      "skipped_index_ids": [
        "string"
      ],
      "type": "stop"
    }
  ],
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Delete Session

`client.beta.chat.delete(stringsessionID, ChatDeleteParamsparams?, RequestOptionsoptions?): void`

**delete** `/api/v1/chat/{session_id}`

Delete a session.

### Parameters

- `sessionID: string`

- `params: ChatDeleteParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Example

```typescript
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
});

await client.beta.chat.delete('session_id');
```

## Get Session Summary

`client.beta.chat.getSummary(stringsessionID, ChatGetSummaryParamsquery?, RequestOptionsoptions?): ChatGetSummaryResponse`

**get** `/api/v1/chat/{session_id}/summary`

Retrieve a session summary by ID.

### Parameters

- `sessionID: string`

- `query: ChatGetSummaryParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `ChatGetSummaryResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Example

```typescript
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
});

const response = await client.beta.chat.getSummary('session_id');

console.log(response.session_id);
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Stream Messages

`client.beta.chat.stream(stringsessionID, ChatStreamParamsparams, RequestOptionsoptions?): ChatStreamResponse`

**post** `/api/v1/chat/{session_id}/messages/stream`

Stream agent events for a chat turn as Server-Sent Events.

### Parameters

- `sessionID: string`

- `params: ChatStreamParams`

  - `index_ids: Array<string>`

    Body param: Indexes to retrieve data from.

  - `prompt: string`

    Body param: User message for this chat turn.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `require_all_indexes?: boolean`

    Body param: Fail the turn if any requested index cannot be queried.

### Returns

- `ChatStreamResponse = unknown`

### Example

```typescript
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
});

const response = await client.beta.chat.stream('session_id', {
  index_ids: ['idx-abc123', 'idx-def456'],
  prompt: 'What were the main findings in Q3?',
});

console.log(response);
```

#### Response

```json
{}
```

## Domain Types

### Chat List Response

- `ChatListResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Chat Create Response

- `ChatCreateResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Chat Retrieve Response

- `ChatRetrieveResponse`

  Full chat session including its complete event history.

  - `events: Array<StopEvent | TextDeltaEvent | TextEvent | 5 more>`

    Ordered list of events that make up the conversation history.

    - `StopEvent`

      - `error: string | null`

      - `is_error: boolean`

      - `usage: Usage`

        - `duration_ms?: number`

        - `total_input_tokens?: number | null`

        - `total_output_tokens?: number | null`

        - `turns?: number`

      - `skipped_index_ids?: Array<string>`

        Requested indexes this turn could not query.

      - `type?: "stop"`

        - `"stop"`

    - `TextDeltaEvent`

      - `content: string`

      - `type?: "text_delta"`

        - `"text_delta"`

    - `TextEvent`

      - `content: string`

      - `type?: "text"`

        - `"text"`

    - `ThinkingDeltaEvent`

      - `content: string`

      - `type?: "thinking_delta"`

        - `"thinking_delta"`

    - `ThinkingEvent`

      - `content: string`

      - `type?: "thinking"`

        - `"thinking"`

    - `ToolCallEvent`

      - `arguments: Record<string, unknown>`

      - `call_id: string`

      - `name: string`

      - `type?: "tool_call"`

        - `"tool_call"`

    - `ToolResultEvent`

      - `call_id: string`

      - `name: string`

      - `result: unknown`

      - `image_attachment?: ImageAttachment | null`

        Coordinates for lazily resolving a page screenshot presigned URL.

        - `attachment_name: string`

        - `source_id: string`

      - `type?: "tool_result"`

        - `"tool_result"`

    - `UserInputEvent`

      - `content: string`

      - `type?: "user_input"`

        - `"user_input"`

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Chat Get Summary Response

- `ChatGetSummaryResponse`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" | "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title?: string | null`

    Auto-generated title derived from the first user message.

  - `index_ids?: Array<string> | null`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata?: JobMetadata | null`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms?: number`

    - `error?: string | null`

    - `export_config_ids?: Array<string> | null`

    - `is_error?: boolean`

    - `total_input_tokens?: number | null`

    - `total_output_tokens?: number | null`

    - `turns?: number`

### Chat Stream Response

- `ChatStreamResponse = unknown`

# Attachments

## List Attachments

`client.beta.attachments.list(AttachmentListParamsquery, RequestOptionsoptions?): PaginatedCursor<AttachmentListResponse>`

**get** `/api/v1/beta/attachments`

List the attachments associated with a file (e.g. per-page screenshots).

### Parameters

- `query: AttachmentListParams`

  - `source_id: string`

    File UUID or directory file ID (dfl-...).

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

### Returns

- `AttachmentListResponse`

  Metadata for a single file attachment.

  - `name: string`

    Name of the attachment

  - `size: number`

    Size of the attachment in bytes

  - `last_modified?: string | null`

    When the attachment was last modified

### Example

```typescript
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 attachmentListResponse of client.beta.attachments.list({
  source_id: 'source_id',
})) {
  console.log(attachmentListResponse.name);
}
```

#### Response

```json
{
  "items": [
    {
      "name": "name",
      "size": 0,
      "last_modified": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Attachment

`client.beta.attachments.get(stringattachmentName, AttachmentGetParamsquery, RequestOptionsoptions?): PresignedURL`

**get** `/api/v1/beta/attachments/{attachment_name}`

Return a presigned download URL for a specific attachment.

### Parameters

- `attachmentName: string`

- `query: AttachmentGetParams`

  - `source_id: string`

    File UUID or directory file ID (dfl-...).

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `PresignedURL`

  Schema for a presigned URL.

  - `expires_at: string`

    The time at which the presigned URL expires

  - `url: string`

    A presigned URL for IO operations against a private file

  - `form_fields?: Record<string, string> | null`

    Form fields for a presigned POST request

### Example

```typescript
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
});

const presignedURL = await client.beta.attachments.get('attachment_name', {
  source_id: 'source_id',
});

console.log(presignedURL.expires_at);
```

#### Response

```json
{
  "expires_at": "2019-12-27T18:11:19.117Z",
  "url": "https://example.com",
  "form_fields": {
    "foo": "string"
  }
}
```

## Domain Types

### Attachment List Response

- `AttachmentListResponse`

  Metadata for a single file attachment.

  - `name: string`

    Name of the attachment

  - `size: number`

    Size of the attachment in bytes

  - `last_modified?: string | null`

    When the attachment was last modified

# Agent Data

## Get Agent Data

`client.beta.agentData.get(stringitemID, AgentDataGetParamsquery?, RequestOptionsoptions?): AgentData`

**get** `/api/v1/beta/agent-data/{item_id}`

Get agent data by ID.

### Parameters

- `itemID: string`

- `query: AgentDataGetParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `AgentData`

  API Result for a single agent data item

  - `data: Record<string, unknown>`

  - `deployment_name: string`

  - `id?: string | null`

  - `collection?: string`

  - `created_at?: string | null`

  - `project_id?: string | null`

  - `updated_at?: string | null`

### Example

```typescript
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
});

const agentData = await client.beta.agentData.get('item_id');

console.log(agentData.id);
```

#### Response

```json
{
  "data": {
    "foo": "bar"
  },
  "deployment_name": "deployment_name",
  "id": "id",
  "collection": "collection",
  "created_at": "2019-12-27T18:11:19.117Z",
  "project_id": "project_id",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Agent Data

`client.beta.agentData.update(stringitemID, AgentDataUpdateParamsparams, RequestOptionsoptions?): AgentData`

**put** `/api/v1/beta/agent-data/{item_id}`

Update agent data by ID (overwrites).

### Parameters

- `itemID: string`

- `params: AgentDataUpdateParams`

  - `data: Record<string, unknown>`

    Body param

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Returns

- `AgentData`

  API Result for a single agent data item

  - `data: Record<string, unknown>`

  - `deployment_name: string`

  - `id?: string | null`

  - `collection?: string`

  - `created_at?: string | null`

  - `project_id?: string | null`

  - `updated_at?: string | null`

### Example

```typescript
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
});

const agentData = await client.beta.agentData.update('item_id', { data: { foo: 'bar' } });

console.log(agentData.id);
```

#### Response

```json
{
  "data": {
    "foo": "bar"
  },
  "deployment_name": "deployment_name",
  "id": "id",
  "collection": "collection",
  "created_at": "2019-12-27T18:11:19.117Z",
  "project_id": "project_id",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Agent Data

`client.beta.agentData.delete(stringitemID, AgentDataDeleteParamsparams?, RequestOptionsoptions?): AgentDataDeleteResponse`

**delete** `/api/v1/beta/agent-data/{item_id}`

Delete agent data by ID.

### Parameters

- `itemID: string`

- `params: AgentDataDeleteParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `AgentDataDeleteResponse = Record<string, string>`

### Example

```typescript
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
});

const agentData = await client.beta.agentData.delete('item_id');

console.log(agentData);
```

#### Response

```json
{
  "foo": "string"
}
```

## Create Agent Data

`client.beta.agentData.create(AgentDataCreateParamsparams, RequestOptionsoptions?): AgentData`

**post** `/api/v1/beta/agent-data`

Create new agent data.

### Parameters

- `params: AgentDataCreateParams`

  - `data: Record<string, unknown>`

    Body param

  - `deployment_name: string`

    Body param

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `collection?: string`

    Body param

### Returns

- `AgentData`

  API Result for a single agent data item

  - `data: Record<string, unknown>`

  - `deployment_name: string`

  - `id?: string | null`

  - `collection?: string`

  - `created_at?: string | null`

  - `project_id?: string | null`

  - `updated_at?: string | null`

### Example

```typescript
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
});

const agentData = await client.beta.agentData.create({
  data: { foo: 'bar' },
  deployment_name: 'deployment_name',
});

console.log(agentData.id);
```

#### Response

```json
{
  "data": {
    "foo": "bar"
  },
  "deployment_name": "deployment_name",
  "id": "id",
  "collection": "collection",
  "created_at": "2019-12-27T18:11:19.117Z",
  "project_id": "project_id",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Search Agent Data

`client.beta.agentData.search(AgentDataSearchParamsparams, RequestOptionsoptions?): PaginatedCursorPost<AgentData>`

**post** `/api/v1/beta/agent-data/:search`

Search agent data with filtering, sorting, and pagination.

### Parameters

- `params: AgentDataSearchParams`

  - `deployment_name: string`

    Body param: The agent deployment's name to search within

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `collection?: string`

    Body param: The logical agent data collection to search within

  - `filter?: Record<string, Filter> | null`

    Body param: A filter object or expression that filters resources listed in the response.

    - `eq?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `excludes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `gt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `gte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `includes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `lt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `lte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `ne?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

  - `include_total?: boolean`

    Body param: Whether to include the total number of items in the response

  - `offset?: number | null`

    Body param: The offset to start from. If not provided, the first page is returned

  - `order_by?: string | null`

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

  - `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.

### Returns

- `AgentData`

  API Result for a single agent data item

  - `data: Record<string, unknown>`

  - `deployment_name: string`

  - `id?: string | null`

  - `collection?: string`

  - `created_at?: string | null`

  - `project_id?: string | null`

  - `updated_at?: string | null`

### Example

```typescript
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 agentData of client.beta.agentData.search({
  deployment_name: 'deployment_name',
})) {
  console.log(agentData.id);
}
```

#### Response

```json
{
  "items": [
    {
      "data": {
        "foo": "bar"
      },
      "deployment_name": "deployment_name",
      "id": "id",
      "collection": "collection",
      "created_at": "2019-12-27T18:11:19.117Z",
      "project_id": "project_id",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Aggregate Agent Data

`client.beta.agentData.aggregate(AgentDataAggregateParamsparams, RequestOptionsoptions?): PaginatedCursorPost<AgentDataAggregateResponse>`

**post** `/api/v1/beta/agent-data/:aggregate`

Aggregate agent data with grouping and optional counting/first item retrieval.

### Parameters

- `params: AgentDataAggregateParams`

  - `deployment_name: string`

    Body param: The agent deployment's name to aggregate data for

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `collection?: string`

    Body param: The logical agent data collection to aggregate data for

  - `count?: boolean | null`

    Body param: Whether to count the number of items in each group

  - `filter?: Record<string, Filter> | null`

    Body param: A filter object or expression that filters resources listed in the response.

    - `eq?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `excludes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `gt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `gte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `includes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `lt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `lte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `ne?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

  - `first?: boolean | null`

    Body param: Whether to return the first item in each group (Sorted by created_at)

  - `group_by?: Array<string> | null`

    Body param: The fields to group by. If empty, the entire dataset is grouped on. e.g. if left out, can be used for simple count operations

  - `offset?: number | null`

    Body param: The offset to start from. If not provided, the first page is returned

  - `order_by?: string | null`

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

  - `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.

### Returns

- `AgentDataAggregateResponse`

  API Result for a single group in the aggregate response

  - `group_key: Record<string, unknown>`

  - `count?: number | null`

  - `first_item?: Record<string, unknown> | null`

### Example

```typescript
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 agentDataAggregateResponse of client.beta.agentData.aggregate({
  deployment_name: 'deployment_name',
})) {
  console.log(agentDataAggregateResponse.group_key);
}
```

#### Response

```json
{
  "items": [
    {
      "group_key": {
        "foo": "bar"
      },
      "count": 0,
      "first_item": {
        "foo": "bar"
      }
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Delete Agent Data By Query

`client.beta.agentData.deleteByQuery(AgentDataDeleteByQueryParamsparams, RequestOptionsoptions?): AgentDataDeleteByQueryResponse`

**post** `/api/v1/beta/agent-data/:delete`

Bulk delete agent data by query (deployment_name, collection, optional filters).

### Parameters

- `params: AgentDataDeleteByQueryParams`

  - `deployment_name: string`

    Body param: The agent deployment's name to delete data for

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `collection?: string`

    Body param: The logical agent data collection to delete from

  - `filter?: Record<string, Filter> | null`

    Body param: Optional filters to select which items to delete

    - `eq?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `excludes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `gt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `gte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `includes?: Array<number | string | (string & {}) | null>`

      - `number`

      - `string`

      - `(string & {})`

    - `lt?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `lte?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

    - `ne?: number | string | (string & {}) | null`

      - `number`

      - `string`

      - `(string & {})`

### Returns

- `AgentDataDeleteByQueryResponse`

  API response for bulk delete operation

  - `deleted_count: number`

### Example

```typescript
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
});

const response = await client.beta.agentData.deleteByQuery({ deployment_name: 'deployment_name' });

console.log(response.deleted_count);
```

#### Response

```json
{
  "deleted_count": 0
}
```

## Domain Types

### Agent Data

- `AgentData`

  API Result for a single agent data item

  - `data: Record<string, unknown>`

  - `deployment_name: string`

  - `id?: string | null`

  - `collection?: string`

  - `created_at?: string | null`

  - `project_id?: string | null`

  - `updated_at?: string | null`

### Agent Data Delete Response

- `AgentDataDeleteResponse = Record<string, string>`

### Agent Data Aggregate Response

- `AgentDataAggregateResponse`

  API Result for a single group in the aggregate response

  - `group_key: Record<string, unknown>`

  - `count?: number | null`

  - `first_item?: Record<string, unknown> | null`

### Agent Data Delete By Query Response

- `AgentDataDeleteByQueryResponse`

  API response for bulk delete operation

  - `deleted_count: number`

# Directories

## Create Directory

`client.beta.directories.create(DirectoryCreateParamsparams, RequestOptionsoptions?): DirectoryCreateResponse`

**post** `/api/v1/beta/directories`

Create a new directory within the specified project.

A connector subscription syncs into at most one directory. Creating a second one for the same
subscription returns `409` with the existing directory's id in `detail.directory_id`.

### Parameters

- `params: DirectoryCreateParams`

  - `name: string`

    Body param: Human-readable name for the directory.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `connector_subscription_id?: string | null`

    Body param: Connector Subscription whose files sync into this directory. Omit for manual uploads.

  - `description?: string | null`

    Body param: Optional description shown to users.

  - `system_metadata?: Record<string, unknown> | null`

    Body param: Reserved system-managed metadata.

  - `type?: "ephemeral" | "user"`

    Body param: Directory type. Use 'ephemeral' for batch processing with automatic cleanup.

    - `"ephemeral"`

    - `"user"`

### Returns

- `DirectoryCreateResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const directory = await client.beta.directories.create({ name: 'x' });

console.log(directory.id);
```

#### Response

```json
{
  "id": "id",
  "name": "x",
  "project_id": "project_id",
  "connector_subscription_id": "csub-abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "system_metadata": {
    "foo": "bar"
  },
  "type": "ephemeral",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## List Directories

`client.beta.directories.list(DirectoryListParamsquery?, RequestOptionsoptions?): PaginatedCursor<DirectoryListResponse>`

**get** `/api/v1/beta/directories`

List Directories

### Parameters

- `query: DirectoryListParams`

  - `include_deleted?: boolean`

    Include deleted directories.

  - `name?: string | null`

    Directory name to match.

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type to include.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `types?: Array<"ephemeral" | "index" | "user"> | null`

    Filter by one or more directory types. Repeat the parameter for multiple values.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

### Returns

- `DirectoryListResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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 directoryListResponse of client.beta.directories.list()) {
  console.log(directoryListResponse.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "name": "x",
      "project_id": "project_id",
      "connector_subscription_id": "csub-abc123",
      "created_at": "2019-12-27T18:11:19.117Z",
      "deleted_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "expires_at": "2019-12-27T18:11:19.117Z",
      "system_metadata": {
        "foo": "bar"
      },
      "type": "ephemeral",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Directory

`client.beta.directories.get(stringdirectoryID, DirectoryGetParamsquery?, RequestOptionsoptions?): DirectoryGetResponse`

**get** `/api/v1/beta/directories/{directory_id}`

Retrieve a directory by its identifier.

### Parameters

- `directoryID: string`

- `query: DirectoryGetParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `DirectoryGetResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const directory = await client.beta.directories.get('directory_id');

console.log(directory.id);
```

#### Response

```json
{
  "id": "id",
  "name": "x",
  "project_id": "project_id",
  "connector_subscription_id": "csub-abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "system_metadata": {
    "foo": "bar"
  },
  "type": "ephemeral",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Directory

`client.beta.directories.update(stringdirectoryID, DirectoryUpdateParamsparams, RequestOptionsoptions?): DirectoryUpdateResponse`

**patch** `/api/v1/beta/directories/{directory_id}`

Update directory metadata.

### Parameters

- `directoryID: string`

- `params: DirectoryUpdateParams`

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `description?: string | null`

    Body param: Updated description for the directory.

  - `name?: string | null`

    Body param: Updated name for the directory.

### Returns

- `DirectoryUpdateResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const directory = await client.beta.directories.update('directory_id');

console.log(directory.id);
```

#### Response

```json
{
  "id": "id",
  "name": "x",
  "project_id": "project_id",
  "connector_subscription_id": "csub-abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "system_metadata": {
    "foo": "bar"
  },
  "type": "ephemeral",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Directory

`client.beta.directories.delete(stringdirectoryID, DirectoryDeleteParamsparams?, RequestOptionsoptions?): void`

**delete** `/api/v1/beta/directories/{directory_id}`

Permanently delete a directory.

### Parameters

- `directoryID: string`

- `params: DirectoryDeleteParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Example

```typescript
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
});

await client.beta.directories.delete('directory_id');
```

## Domain Types

### Directory Create Response

- `DirectoryCreateResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Directory List Response

- `DirectoryListResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Directory Get Response

- `DirectoryGetResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

### Directory Update Response

- `DirectoryUpdateResponse`

  API response schema for a directory.

  - `id: string`

    Unique identifier for the directory.

  - `name: string`

    Human-readable name for the directory.

  - `project_id: string`

    Project the directory belongs to.

  - `connector_subscription_id?: string | null`

    Connector Subscription whose files sync into this directory. Null for a directory populated by manual uploads.

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Optional timestamp of when the directory was deleted. Null if not deleted.

  - `description?: string | null`

    Optional description shown to users.

  - `expires_at?: string | null`

    When this directory expires and is eligible for cleanup.

  - `system_metadata?: Record<string, unknown> | null`

    Reserved system-managed metadata.

  - `type?: "ephemeral" | "index" | "user" | null`

    Directory type: 'user', 'index', or 'ephemeral'.

    - `"ephemeral"`

    - `"index"`

    - `"user"`

  - `updated_at?: string | null`

    Update datetime

# Files

## Add Directory File

`client.beta.directories.files.add(stringdirectoryID, FileAddParamsparams, RequestOptionsoptions?): FileAddResponse`

**post** `/api/v1/beta/directories/{directory_id}/files`

Create a new file within the specified directory; the directory must exist in the project and `file_id` must reference an existing file.

### Parameters

- `directoryID: string`

- `params: FileAddParams`

  - `file_id: string`

    Body param: File ID for the storage location (required).

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `display_name?: string | null`

    Body param: Display name for the file. If not provided, will use the file's name.

  - `metadata?: Record<string, string | number | number | 3 more> | null`

    Body param: User-defined metadata key-value pairs to associate with the file.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `unique_id?: string | null`

    Body param: Unique identifier for the file in the directory. If not provided, will use the file's external_file_id or name.

### Returns

- `FileAddResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const response = await client.beta.directories.files.add('directory_id', { file_id: 'file_id' });

console.log(response.id);
```

#### Response

```json
{
  "id": "id",
  "directory_id": "directory_id",
  "display_name": "x",
  "project_id": "project_id",
  "unique_id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "download_url": {
    "expires_at": "2019-12-27T18:11:19.117Z",
    "url": "https://example.com",
    "form_fields": {
      "foo": "string"
    }
  },
  "file_id": "file_id",
  "metadata": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## List Directory Files

`client.beta.directories.files.list(stringdirectoryID, FileListParamsquery?, RequestOptionsoptions?): PaginatedCursor<FileListResponse>`

**get** `/api/v1/beta/directories/{directory_id}/files`

List all files within the specified directory with optional filtering and pagination.

### Parameters

- `directoryID: string`

- `query: FileListParams`

  - `display_name?: string | null`

  - `display_name_contains?: string | null`

  - `expand?: Array<string> | null`

    Fields to expand on each directory file.

  - `file_id?: string | null`

  - `include_deleted?: boolean`

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

  - `unique_id?: string | null`

  - `updated_at_on_or_after?: string | null`

    Include items updated at or after this timestamp (inclusive)

  - `updated_at_on_or_before?: string | null`

    Include items updated at or before this timestamp (inclusive)

### Returns

- `FileListResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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 fileListResponse of client.beta.directories.files.list('directory_id')) {
  console.log(fileListResponse.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "directory_id": "directory_id",
      "display_name": "x",
      "project_id": "project_id",
      "unique_id": "x",
      "created_at": "2019-12-27T18:11:19.117Z",
      "deleted_at": "2019-12-27T18:11:19.117Z",
      "download_url": {
        "expires_at": "2019-12-27T18:11:19.117Z",
        "url": "https://example.com",
        "form_fields": {
          "foo": "string"
        }
      },
      "file_id": "file_id",
      "metadata": {
        "foo": "string"
      },
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Directory File

`client.beta.directories.files.get(stringdirectoryFileID, FileGetParamsparams, RequestOptionsoptions?): FileGetResponse`

**get** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}`

Get a directory file by `directory_file_id`; to look up by `unique_id`, use the list endpoint with a filter.

### Parameters

- `directoryFileID: string`

- `params: FileGetParams`

  - `directory_id: string`

    Path param

  - `expand?: Array<string> | null`

    Query param: Fields to expand.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Returns

- `FileGetResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const file = await client.beta.directories.files.get('directory_file_id', {
  directory_id: 'directory_id',
});

console.log(file.id);
```

#### Response

```json
{
  "id": "id",
  "directory_id": "directory_id",
  "display_name": "x",
  "project_id": "project_id",
  "unique_id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "download_url": {
    "expires_at": "2019-12-27T18:11:19.117Z",
    "url": "https://example.com",
    "form_fields": {
      "foo": "string"
    }
  },
  "file_id": "file_id",
  "metadata": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Directory File

`client.beta.directories.files.update(stringdirectoryFileID, FileUpdateParamsparams, RequestOptionsoptions?): FileUpdateResponse`

**patch** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}`

Update directory-file metadata by `directory_file_id`; set `directory_id` to move the file to a different directory. To resolve from `unique_id`, list with a filter first.

### Parameters

- `directoryFileID: string`

- `params: FileUpdateParams`

  - `directory_id: string`

    Path param

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `display_name?: string | null`

    Body param: Updated display name.

  - `metadata?: Record<string, string | number | number | 3 more> | null`

    Body param: User-defined metadata key-value pairs. Replaces the user metadata layer.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `target_directory_id?: string | null`

    Body param: Move file to a different directory.

  - `unique_id?: string | null`

    Body param: Updated unique identifier.

### Returns

- `FileUpdateResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const file = await client.beta.directories.files.update('directory_file_id', {
  directory_id: 'directory_id',
});

console.log(file.id);
```

#### Response

```json
{
  "id": "id",
  "directory_id": "directory_id",
  "display_name": "x",
  "project_id": "project_id",
  "unique_id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "download_url": {
    "expires_at": "2019-12-27T18:11:19.117Z",
    "url": "https://example.com",
    "form_fields": {
      "foo": "string"
    }
  },
  "file_id": "file_id",
  "metadata": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Directory File

`client.beta.directories.files.delete(stringdirectoryFileID, FileDeleteParamsparams, RequestOptionsoptions?): void`

**delete** `/api/v1/beta/directories/{directory_id}/files/{directory_file_id}`

Delete a directory file by `directory_file_id`; to resolve from `unique_id`, list with a filter first.

### Parameters

- `directoryFileID: string`

- `params: FileDeleteParams`

  - `directory_id: string`

    Path param

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

### Example

```typescript
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
});

await client.beta.directories.files.delete('directory_file_id', { directory_id: 'directory_id' });
```

## Upload File To Directory

`client.beta.directories.files.upload(stringdirectoryID, FileUploadParamsparams, RequestOptionsoptions?): FileUploadResponse`

**post** `/api/v1/beta/directories/{directory_id}/files/upload`

Upload a file and create its directory entry in one call; `unique_id` / `display_name` default to values derived from file metadata.

### Parameters

- `directoryID: string`

- `params: FileUploadParams`

  - `upload_file: Uploadable`

    Body param

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `display_name?: string | null`

    Body param

  - `external_file_id?: string | null`

    Body param

  - `metadata?: string | null`

    Body param: User metadata as a JSON object string.

  - `unique_id?: string | null`

    Body param

### Returns

- `FileUploadResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
import fs from 'fs';
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
});

const response = await client.beta.directories.files.upload('directory_id', {
  upload_file: fs.createReadStream('path/to/file'),
});

console.log(response.id);
```

#### Response

```json
{
  "id": "id",
  "directory_id": "directory_id",
  "display_name": "x",
  "project_id": "project_id",
  "unique_id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "download_url": {
    "expires_at": "2019-12-27T18:11:19.117Z",
    "url": "https://example.com",
    "form_fields": {
      "foo": "string"
    }
  },
  "file_id": "file_id",
  "metadata": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Domain Types

### File Add Response

- `FileAddResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### File List Response

- `FileListResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### File Get Response

- `FileGetResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### File Update Response

- `FileUpdateResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

### File Upload Response

- `FileUploadResponse`

  API response schema for a directory file.

  - `id: string`

    Unique identifier for the directory file.

  - `directory_id: string`

    Directory the file belongs to.

  - `display_name: string`

    Display name for the file.

  - `project_id: string`

    Project the directory file belongs to.

  - `unique_id: string`

    Unique identifier for the file in the directory

  - `created_at?: string | null`

    Creation datetime

  - `deleted_at?: string | null`

    Soft delete marker when the file is removed upstream or by user action.

  - `download_url?: PresignedURL | null`

    Schema for a presigned URL.

    - `expires_at: string`

      The time at which the presigned URL expires

    - `url: string`

      A presigned URL for IO operations against a private file

    - `form_fields?: Record<string, string> | null`

      Form fields for a presigned POST request

  - `file_id?: string | null`

    File ID for the storage location.

  - `metadata?: Record<string, string | number | number | 3 more>`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `number`

    - `number`

    - `boolean`

    - `unknown`

    - `Array<string>`

  - `updated_at?: string | null`

    Update datetime

# Split

## Create Split Job

`client.beta.split.create(SplitCreateParamsparams, RequestOptionsoptions?): SplitCreateResponse`

**post** `/api/v1/beta/split/jobs`

Create a document split job.

### Parameters

- `params: SplitCreateParams`

  - `document_input: SplitDocumentInput`

    Body param: Document to be split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `organization_id?: string | null`

    Query param

  - `project_id?: string | null`

    Query param

  - `configuration?: Configuration | null`

    Body param: Split configuration with categories and splitting strategy.

    - `categories: Array<SplitCategory>`

      Categories to split documents into.

      - `name: string`

        Name of the category.

      - `description?: string | null`

        Optional description of what content belongs in this category.

    - `splitting_strategy?: SplittingStrategy`

      Strategy for splitting documents.

      - `allow_uncategorized?: "forbid" | "include" | "omit"`

        Controls handling of pages that don't match any category. 'include': pages can be grouped as 'uncategorized' and included in results. 'forbid': all pages must be assigned to a defined category. 'omit': pages can be classified as 'uncategorized' but are excluded from results.

        - `"forbid"`

        - `"include"`

        - `"omit"`

      - `custom_instructions?: string | null`

        Free-form guidance for where segment boundaries are placed.

      - `min_pages_per_split?: number`

        Minimum pages per segment. Shorter segments are merged into an adjacent segment; 1 disables merging.

    - `version?: string | null`

      Split version to run. Omit for the current release. Preview versions are selectable by name and never resolved automatically.

  - `configuration_id?: string | null`

    Body param: Saved split configuration ID.

### Returns

- `SplitCreateResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const split = await client.beta.split.create({ document_input: { type: 'type', value: 'value' } });

console.log(split.id);
```

#### Response

```json
{
  "id": "id",
  "categories": [
    {
      "name": "x",
      "description": "x"
    }
  ],
  "document_input": {
    "type": "type",
    "value": "value"
  },
  "project_id": "project_id",
  "status": "status",
  "user_id": "user_id",
  "configuration_id": "configuration_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "result": {
    "segments": [
      {
        "category": "category",
        "confidence_category": "confidence_category",
        "pages": [
          0
        ]
      }
    ]
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## List Split Jobs

`client.beta.split.list(SplitListParamsquery?, RequestOptionsoptions?): PaginatedCursor<SplitListResponse>`

**get** `/api/v1/beta/split/jobs`

List document split jobs.

### Parameters

- `query: SplitListParams`

  - `created_at_on_or_after?: string | null`

    Include items created at or after this timestamp (inclusive)

  - `created_at_on_or_before?: string | null`

    Include items created at or before this timestamp (inclusive)

  - `job_ids?: Array<string> | null`

    Filter by specific job IDs

  - `organization_id?: string | null`

  - `page_size?: number | null`

  - `page_token?: string | null`

  - `project_id?: string | null`

  - `status?: "cancelled" | "completed" | "failed" | 2 more | null`

    Filter by job status (pending, processing, completed, failed, cancelled)

    - `"cancelled"`

    - `"completed"`

    - `"failed"`

    - `"pending"`

    - `"processing"`

### Returns

- `SplitListResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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 splitListResponse of client.beta.split.list()) {
  console.log(splitListResponse.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "categories": [
        {
          "name": "x",
          "description": "x"
        }
      ],
      "document_input": {
        "type": "type",
        "value": "value"
      },
      "project_id": "project_id",
      "status": "status",
      "user_id": "user_id",
      "configuration_id": "configuration_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "error_message": "error_message",
      "result": {
        "segments": [
          {
            "category": "category",
            "confidence_category": "confidence_category",
            "pages": [
              0
            ]
          }
        ]
      },
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Split Job

`client.beta.split.get(stringsplitJobID, SplitGetParamsquery?, RequestOptionsoptions?): SplitGetResponse`

**get** `/api/v1/beta/split/jobs/{split_job_id}`

Get a document split job.

### Parameters

- `splitJobID: string`

- `query: SplitGetParams`

  - `organization_id?: string | null`

  - `project_id?: string | null`

### Returns

- `SplitGetResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime

### Example

```typescript
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
});

const split = await client.beta.split.get('split_job_id');

console.log(split.id);
```

#### Response

```json
{
  "id": "id",
  "categories": [
    {
      "name": "x",
      "description": "x"
    }
  ],
  "document_input": {
    "type": "type",
    "value": "value"
  },
  "project_id": "project_id",
  "status": "status",
  "user_id": "user_id",
  "configuration_id": "configuration_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "result": {
    "segments": [
      {
        "category": "category",
        "confidence_category": "confidence_category",
        "pages": [
          0
        ]
      }
    ]
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Domain Types

### Split Category

- `SplitCategory`

  Category definition for document splitting.

  - `name: string`

    Name of the category.

  - `description?: string | null`

    Optional description of what content belongs in this category.

### Split Document Input

- `SplitDocumentInput`

  Document input specification for beta API.

  - `type: string`

    The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

  - `value: string`

    Document identifier.

### Split Result Response

- `SplitResultResponse`

  Result of a completed split job.

  - `segments: Array<SplitSegmentResponse>`

    List of document segments.

    - `category: string`

      Category name this split belongs to.

    - `confidence_category: string`

      Categorical confidence level. Valid values are: high, medium, low.

    - `pages: Array<number>`

      Page numbers in this segment, as numbered by the input document.

### Split Segment Response

- `SplitSegmentResponse`

  A segment of the split document.

  - `category: string`

    Category name this split belongs to.

  - `confidence_category: string`

    Categorical confidence level. Valid values are: high, medium, low.

  - `pages: Array<number>`

    Page numbers in this segment, as numbered by the input document.

### Split Create Response

- `SplitCreateResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime

### Split List Response

- `SplitListResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime

### Split Get Response

- `SplitGetResponse`

  Beta response — uses nested document_input object.

  - `id: string`

    Unique identifier for the split job.

  - `categories: Array<SplitCategory>`

    Categories used for splitting.

    - `name: string`

      Name of the category.

    - `description?: string | null`

      Optional description of what content belongs in this category.

  - `document_input: SplitDocumentInput`

    Document that was split.

    - `type: string`

      The beta `POST /api/v1/beta/split/jobs` endpoint accepts only `file_id`. To use a Parse job as input, call `POST /api/v1/split/jobs` instead, where you can pass the Parse job ID as `file_input`.

    - `value: string`

      Document identifier.

  - `project_id: string`

    Project ID this job belongs to.

  - `status: string`

    Current status of the job. Valid values are: pending, processing, completed, failed, cancelled.

  - `user_id: string`

    User ID who created this job.

  - `configuration_id?: string | null`

    Split configuration ID used for this job.

  - `created_at?: string | null`

    Creation datetime

  - `error_message?: string | null`

    Error message if the job failed.

  - `result?: SplitResultResponse | null`

    Result of a completed split job.

    - `segments: Array<SplitSegmentResponse>`

      List of document segments.

      - `category: string`

        Category name this split belongs to.

      - `confidence_category: string`

        Categorical confidence level. Valid values are: high, medium, low.

      - `pages: Array<number>`

        Page numbers in this segment, as numbered by the input document.

  - `updated_at?: string | null`

    Update datetime
