# Documents
(*documents*)

## Overview

### Available Operations

* [list](#list) - List documents within an index
* [batchIndex](#batchindex) - Batch index text documents
* [indexFile](#indexfile) - Index a document by uploading a file
* [indexMultimodal](#indexmultimodal) - Index a document from an image and text content
* [index](#index) - Index a document from text content
* [retrieve](#retrieve) - Retrieve documents from an index
* [retrieveSimilar](#retrievesimilar) - Find documents similar to a given document
* [delete](#delete) - Delete a document
* [get](#get) - Get a document by ID with pagination

## list

Retrieve a list of all documents.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="listDocuments" method="get" path="/v1/documents" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.list({
    indexName: "<value>",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsList } from "duckyai-ts/funcs/documentsList.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsList(ducky, {
    indexName: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsList failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [operations.ListDocumentsRequest](../../models/operations/listdocumentsrequest.md)                                                                                             | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.ListPaginatedDocumentsResponse](../../models/components/listpaginateddocumentsresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400                  | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## batchIndex

Batch index text documents. Limited to 100 documents per batch.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="batchIndexText" method="post" path="/v1/documents/batch-index-text" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  await ducky.documents.batchIndex({
    documents: [
      {
        indexName: "index_name",
        docId: "doc_id",
        content: "content",
        title: "title",
        url: "url",
        fileId: "file_id",
        metadata: {
          "key": "",
        },
      },
      {
        indexName: "index_name",
        docId: "doc_id",
        content: "content",
        title: "title",
        url: "url",
        fileId: "file_id",
        metadata: {
          "key": "",
        },
      },
    ],
  });


}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsBatchIndex } from "duckyai-ts/funcs/documentsBatchIndex.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsBatchIndex(ducky, {
    documents: [
      {
        indexName: "index_name",
        docId: "doc_id",
        content: "content",
        title: "title",
        url: "url",
        fileId: "file_id",
        metadata: {
          "key": "",
        },
      },
      {
        indexName: "index_name",
        docId: "doc_id",
        content: "content",
        title: "title",
        url: "url",
        fileId: "file_id",
        metadata: {
          "key": "",
        },
      },
    ],
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("documentsBatchIndex failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.BatchIndexTextRequest](../../models/components/batchindextextrequest.md)                                                                                           | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<void\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## indexFile

Index a document into the specified index by uploading a file. Supports UTF-8 encoded text-based files and PDF files. The file size must be less than 60MB.


### Example Usage

<!-- UsageSnippet language="typescript" operationID="indexFile" method="post" path="/v1/documents/index-file" -->
```typescript
import { Ducky } from "duckyai-ts";
import { openAsBlob } from "node:fs";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.indexFile({
    indexName: "<value>",
    file: await openAsBlob("example.file"),
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsIndexFile } from "duckyai-ts/funcs/documentsIndexFile.js";
import { openAsBlob } from "node:fs";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsIndexFile(ducky, {
    indexName: "<value>",
    file: await openAsBlob("example.file"),
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsIndexFile failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.IndexFileRequest](../../models/components/indexfilerequest.md)                                                                                                     | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.DocumentIndexedResponse](../../models/components/documentindexedresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404, 422        | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## indexMultimodal

Index a document into the specified index by providing the image and text content as a JSON object.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="indexMultimodal" method="post" path="/v1/documents/index-multimodal" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.indexMultimodal({
    indexName: "index_name",
    docId: "doc_id",
    image: {
      url: "https://openapi-generator.tech",
      base64: "base64",
      mimeType: "mime_type",
    },
    content: "content",
    title: "title",
    url: "url",
    metadata: {
      "key": "",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsIndexMultimodal } from "duckyai-ts/funcs/documentsIndexMultimodal.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsIndexMultimodal(ducky, {
    indexName: "index_name",
    docId: "doc_id",
    image: {
      url: "https://openapi-generator.tech",
      base64: "base64",
      mimeType: "mime_type",
    },
    content: "content",
    title: "title",
    url: "url",
    metadata: {
      "key": "",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsIndexMultimodal failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.IndexMultimodalRequest](../../models/components/indexmultimodalrequest.md)                                                                                         | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.DocumentIndexedResponse](../../models/components/documentindexedresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404, 422        | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## index

Index a document into the specified index by providing the content as a JSON object.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="indexText" method="post" path="/v1/documents/index-text" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.index({
    indexName: "index_name",
    docId: "doc_id",
    content: "content",
    title: "title",
    url: "url",
    fileId: "file_id",
    metadata: {
      "key": "",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsIndex } from "duckyai-ts/funcs/documentsIndex.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsIndex(ducky, {
    indexName: "index_name",
    docId: "doc_id",
    content: "content",
    title: "title",
    url: "url",
    fileId: "file_id",
    metadata: {
      "key": "",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsIndex failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.IndexTextRequest](../../models/components/indextextrequest.md)                                                                                                     | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.DocumentIndexedResponse](../../models/components/documentindexedresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## retrieve

Retrieve documents from an index using a query, top_k, and other parameters

### Example Usage

<!-- UsageSnippet language="typescript" operationID="retrieveDocuments" method="post" path="/v1/documents/retrieve" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.retrieve({
    indexName: "index_name",
    query: "query",
    topK: 164,
    alpha: 0.6027456183070403,
    rerank: true,
    metadataFilter: {
      "key": "",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsRetrieve } from "duckyai-ts/funcs/documentsRetrieve.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsRetrieve(ducky, {
    indexName: "index_name",
    query: "query",
    topK: 164,
    alpha: 0.6027456183070403,
    rerank: true,
    metadataFilter: {
      "key": "",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsRetrieve failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.RetrieveDocumentsRequest](../../models/components/retrievedocumentsrequest.md)                                                                                     | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.RetrieveDocumentsResponse](../../models/components/retrievedocumentsresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## retrieveSimilar

Retrieve documents that are similar to a specified document based on content similarity

### Example Usage

<!-- UsageSnippet language="typescript" operationID="retrieveSimilarDocuments" method="post" path="/v1/documents/retrieve-similar" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.retrieveSimilar({
    docId: "doc_id",
    indexName: "index_name",
    limit: 8,
    metadataFilter: {
      "key": "",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsRetrieveSimilar } from "duckyai-ts/funcs/documentsRetrieveSimilar.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsRetrieveSimilar(ducky, {
    docId: "doc_id",
    indexName: "index_name",
    limit: 8,
    metadataFilter: {
      "key": "",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsRetrieveSimilar failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [components.RetrieveSimilarDocumentsRequest](../../models/components/retrievesimilardocumentsrequest.md)                                                                       | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.RetrieveDocumentsResponse](../../models/components/retrievedocumentsresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 404, 422             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## delete

Delete a specific document by providing its unique identifier.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="deleteDocument" method="delete" path="/v1/documents/{doc_id}" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  await ducky.documents.delete({
    docId: "<id>",
    indexName: "<value>",
  });


}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsDelete } from "duckyai-ts/funcs/documentsDelete.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsDelete(ducky, {
    docId: "<id>",
    indexName: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    
  } else {
    console.log("documentsDelete failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [operations.DeleteDocumentRequest](../../models/operations/deletedocumentrequest.md)                                                                                           | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<void\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |

## get

Retrieve a specific document by providing the document ID, supporting pagination for large documents with multiple chunks.

### Example Usage

<!-- UsageSnippet language="typescript" operationID="getDocument" method="get" path="/v1/documents/{doc_id}" -->
```typescript
import { Ducky } from "duckyai-ts";

const ducky = new Ducky({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const result = await ducky.documents.get({
    docId: "<id>",
    indexName: "<value>",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { DuckyCore } from "duckyai-ts/core.js";
import { documentsGet } from "duckyai-ts/funcs/documentsGet.js";

// Use `DuckyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const ducky = new DuckyCore({
  apiKey: process.env["DUCKY_API_KEY"] ?? "",
});

async function run() {
  const res = await documentsGet(ducky, {
    docId: "<id>",
    indexName: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("documentsGet failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter                                                                                                                                                                      | Type                                                                                                                                                                           | Required                                                                                                                                                                       | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`                                                                                                                                                                      | [operations.GetDocumentRequest](../../models/operations/getdocumentrequest.md)                                                                                                 | :heavy_check_mark:                                                                                                                                                             | The request object to use for the request.                                                                                                                                     |
| `options`                                                                                                                                                                      | RequestOptions                                                                                                                                                                 | :heavy_minus_sign:                                                                                                                                                             | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions`                                                                                                                                                         | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                        | :heavy_minus_sign:                                                                                                                                                             | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`                                                                                                                                                              | [RetryConfig](../../lib/utils/retryconfig.md)                                                                                                                                  | :heavy_minus_sign:                                                                                                                                                             | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise\<[components.DocumentRetrievedResponse](../../models/components/documentretrievedresponse.md)\>**

### Errors

| Error Type           | Status Code          | Content Type         |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400, 404             | application/json     |
| errors.APIError      | 4XX, 5XX             | \*/\*                |