# DocumentControllerApi

All URIs are relative to *http://localhost:8081*

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**createBlankDocument**](#createblankdocument) | **POST** /api/v1/documents/create-blank | Create a blank document from template|
|[**deleteDocumentMetadata**](#deletedocumentmetadata) | **DELETE** /api/v1/documents/{documentId}/metadata | Delete specific metadata keys|
|[**downloadDocument**](#downloaddocument) | **GET** /api/v1/documents/{documentId}/download | Download a document|
|[**downloadForOnlyOffice**](#downloadforonlyoffice) | **GET** /api/v1/documents/{documentId}/onlyoffice-download | Download document for OnlyOffice|
|[**downloadMultipleDocumentsAsZip**](#downloadmultipledocumentsaszip) | **POST** /api/v1/documents/download-multiple | Download multiple documents as ZIP|
|[**getDocumentAncestors**](#getdocumentancestors) | **GET** /api/v1/documents/{documentId}/ancestors | Get document ancestors|
|[**getDocumentInfo**](#getdocumentinfo) | **GET** /api/v1/documents/{documentId}/info | Get information of a document|
|[**getDocumentIntegrity**](#getdocumentintegrity) | **GET** /api/v1/documents/{documentId}/integrity | Get a document\&#39;s integrity ledger|
|[**getDocumentMetadata**](#getdocumentmetadata) | **POST** /api/v1/documents/{documentId}/search/metadata | Search metadata of a document|
|[**getDocumentPosition**](#getdocumentposition) | **GET** /api/v1/documents/{documentId}/position | Get document position in folder|
|[**replaceDocumentContent**](#replacedocumentcontent) | **PUT** /api/v1/documents/{documentId}/replace-content | Replace document content|
|[**replaceDocumentMetadata**](#replacedocumentmetadata) | **PUT** /api/v1/documents/{documentId}/replace-metadata | Replace document metadata|
|[**searchDocumentIdsByMetadata**](#searchdocumentidsbymetadata) | **POST** /api/v1/documents/search/ids-by-metadata | Search document IDs by metadata|
|[**updateDocumentMetadata**](#updatedocumentmetadata) | **PATCH** /api/v1/documents/{documentId}/metadata | Update document metadata|
|[**uploadDocument**](#uploaddocument) | **POST** /api/v1/documents/upload-multiple | Upload multiple documents|
|[**uploadDocument1**](#uploaddocument1) | **POST** /api/v1/documents/upload | Upload a single document|

# **createBlankDocument**
> UploadResponse createBlankDocument(createBlankDocumentRequest)

Creates a new blank document (Word, Excel, PowerPoint, or Text) from a template in the specified folder.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration,
    CreateBlankDocumentRequest
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let createBlankDocumentRequest: CreateBlankDocumentRequest; //

const { status, data } = await apiInstance.createBlankDocument(
    createBlankDocumentRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **createBlankDocumentRequest** | **CreateBlankDocumentRequest**|  | |


### Return type

**UploadResponse**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **deleteDocumentMetadata**
> deleteDocumentMetadata(deleteMetadataRequest)

Deletes specified metadata keys from a document.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration,
    DeleteMetadataRequest
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let deleteMetadataRequest: DeleteMetadataRequest; //

const { status, data } = await apiInstance.deleteDocumentMetadata(
    documentId,
    deleteMetadataRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **deleteMetadataRequest** | **DeleteMetadataRequest**|  | |
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

void (empty response body)

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: Not defined


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **downloadDocument**
> File downloadDocument()

Downloads a single file document.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)

const { status, data } = await apiInstance.downloadDocument(
    documentId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**File**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **downloadForOnlyOffice**
> File downloadForOnlyOffice()

Internal endpoint for OnlyOffice DocumentServer to fetch document content. Uses token-based authentication.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let token: string; // (default to undefined)
let versionId: string; // (optional) (default to undefined)

const { status, data } = await apiInstance.downloadForOnlyOffice(
    documentId,
    token,
    versionId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **token** | [**string**] |  | defaults to undefined|
| **versionId** | [**string**] |  | (optional) defaults to undefined|


### Return type

**File**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **downloadMultipleDocumentsAsZip**
> File downloadMultipleDocumentsAsZip(requestBody)

Downloads multiple documents as a single ZIP file.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let requestBody: Array<string>; //

const { status, data } = await apiInstance.downloadMultipleDocumentsAsZip(
    requestBody
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **requestBody** | **Array<string>**|  | |


### Return type

**File**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getDocumentAncestors**
> Array<AncestorInfo> getDocumentAncestors()

Retrieves all ancestor folders (parent path) of a document, ordered from root to immediate parent.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)

const { status, data } = await apiInstance.getDocumentAncestors(
    documentId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**Array<AncestorInfo>**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getDocumentInfo**
> DocumentInfo getDocumentInfo()

Retrieves information for a document.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let withMetadata: boolean; //if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response (optional) (default to undefined)

const { status, data } = await apiInstance.getDocumentInfo(
    documentId,
    withMetadata
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **withMetadata** | [**boolean**] | if false : only name, type and parentId are sent (when not null) - if true : metadata and size are added in the response | (optional) defaults to undefined|


### Return type

**DocumentInfo**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getDocumentIntegrity**
> Array<DocumentIntegrityRecord> getDocumentIntegrity()

Append-only history of what this document\'s content hashed to, newest first. Unlike the sha256 in metadata, these entries cannot be modified or deleted — a database trigger refuses UPDATE and DELETE on the table. Empty for documents uploaded before the ledger existed, or when openfilz.calculate-checksum is off.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)

const { status, data } = await apiInstance.getDocumentIntegrity(
    documentId
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**Array<DocumentIntegrityRecord>**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getDocumentMetadata**
> { [key: string]: any; } getDocumentMetadata()

Retrieves metadata for a document. Can filter by keys.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration,
    SearchMetadataRequest
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let searchMetadataRequest: SearchMetadataRequest; // (optional)

const { status, data } = await apiInstance.getDocumentMetadata(
    documentId,
    searchMetadataRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **searchMetadataRequest** | **SearchMetadataRequest**|  | |
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**{ [key: string]: any; }**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **getDocumentPosition**
> DocumentPosition getDocumentPosition()

Retrieves the position of a document within its parent folder, useful for pagination.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let sortBy: string; //Field to sort by (name, updated_at, created_at, size, type). Defaults to \'name\'. (optional) (default to 'name')
let sortOrder: string; //Sort order (ASC or DESC). Defaults to \'ASC\'. (optional) (default to 'ASC')

const { status, data } = await apiInstance.getDocumentPosition(
    documentId,
    sortBy,
    sortOrder
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **sortBy** | [**string**] | Field to sort by (name, updated_at, created_at, size, type). Defaults to \&#39;name\&#39;. | (optional) defaults to 'name'|
| **sortOrder** | [**string**] | Sort order (ASC or DESC). Defaults to \&#39;ASC\&#39;. | (optional) defaults to 'ASC'|


### Return type

**DocumentPosition**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **replaceDocumentContent**
> ElementInfo replaceDocumentContent()

Replaces the content of an existing file document.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let file: File; // (default to undefined)

const { status, data } = await apiInstance.replaceDocumentContent(
    documentId,
    file
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **documentId** | [**string**] |  | defaults to undefined|
| **file** | [**File**] |  | defaults to undefined|


### Return type

**ElementInfo**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: multipart/form-data
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **replaceDocumentMetadata**
> ElementInfo replaceDocumentMetadata(requestBody)

Replaces all metadata of a document (file or folder).

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let requestBody: { [key: string]: any; }; //New metadata map. Replaces all existing metadata.

const { status, data } = await apiInstance.replaceDocumentMetadata(
    documentId,
    requestBody
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **requestBody** | **{ [key: string]: any; }**| New metadata map. Replaces all existing metadata. | |
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**ElementInfo**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **searchDocumentIdsByMetadata**
> Array<string> searchDocumentIdsByMetadata(searchByMetadataRequest)

Finds document IDs matching all provided metadata criteria.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration,
    SearchByMetadataRequest
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let searchByMetadataRequest: SearchByMetadataRequest; //

const { status, data } = await apiInstance.searchDocumentIdsByMetadata(
    searchByMetadataRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **searchByMetadataRequest** | **SearchByMetadataRequest**|  | |


### Return type

**Array<string>**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **updateDocumentMetadata**
> ElementInfo updateDocumentMetadata(updateMetadataRequest)

Updates or adds specific metadata fields for a document.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration,
    UpdateMetadataRequest
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let documentId: string; // (default to undefined)
let updateMetadataRequest: UpdateMetadataRequest; //

const { status, data } = await apiInstance.updateDocumentMetadata(
    documentId,
    updateMetadataRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **updateMetadataRequest** | **UpdateMetadataRequest**|  | |
| **documentId** | [**string**] |  | defaults to undefined|


### Return type

**ElementInfo**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **uploadDocument**
> Array<UploadResponse> uploadDocument()

Uploads multiple files, optionally with metadata and a parent folder ID. Returns HTTP 200 if all uploads succeed, HTTP 207 (Multi-Status) if some succeed and some fail, or an appropriate error status (404, 409, 403, 500) if all uploads fail.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let file: Array<File>; // (default to undefined)
let allowDuplicateFileNames: boolean; //When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. (optional) (default to false)
let autoFile: boolean; //Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. (optional) (default to undefined)
let parametersByFilename: string; //Paste the JSON array here<br>This array provides optional metadata and attributes for the uploaded files<br><section>  <h3>Each object in the array must contain:</h3>    <table>     <thead>       <tr>         <th>Field</th>         <th>Type</th>         <th>Description</th>       </tr>     </thead>     <tbody>       <tr>         <td><code>filename</code></td>         <td><code>String</code></td>         <td>Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.</td>       </tr>       <tr>         <td><code>fileAttributes</code></td>         <td><code>JSON Object</code></td>         <td>Container for metadata and other file-specific attributes.</td>       </tr>     </tbody>   </table>    <h4>Inside <code>fileAttributes</code>:</h4>   <table>     <thead>       <tr>         <th>Field</th>         <th>Type</th>         <th>Description</th>       </tr>     </thead>     <tbody>       <tr>         <td><code>parentFolderId</code></td>         <td><code>UUID</code></td>         <td>UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)</td>       </tr>       <tr>         <td><code>metadata</code></td>         <td><code>Map&lt;String, JSON Object&gt;</code></td>         <td>Arbitrary metadata to associate with the file (key/value pairs).</td>       </tr>     </tbody>   </table>    <h4>Example of <code>parametersByFilename</code> JSON array :</h4>   <pre><code>[   {     \\\"filename\\\": \\\"file1.txt\\\",     \\\"fileAttributes\\\": {       \\\"parentFolderId\\\": \\\"f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\",       \\\"metadata\\\": {         \\\"country\\\": \\\"UK\\\",         \\\"owner\\\": {           \\\"name\\\": \\\"Joe\\\",           \\\"owner_id\\\": 1234568         }       }     }   },   {     \\\"filename\\\": \\\"file2.md\\\",     \\\"fileAttributes\\\": {       \\\"metadata\\\": {         \\\"key1\\\": \\\"value1\\\",         \\\"key2\\\": \\\"value2\\\",         \\\"key3\\\": \\\"value3\\\"       }     }   } ]</code></pre> </section> (optional) (default to undefined)

const { status, data } = await apiInstance.uploadDocument(
    file,
    allowDuplicateFileNames,
    autoFile,
    parametersByFilename
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **file** | **Array&lt;File&gt;** |  | defaults to undefined|
| **allowDuplicateFileNames** | [**boolean**] | When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. | (optional) defaults to false|
| **autoFile** | [**boolean**] | Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent &#x3D; the user\&#39;s own switch. Needs openfilz.ai.auto-file.active. | (optional) defaults to undefined|
| **parametersByFilename** | [**string**] | Paste the JSON array here&lt;br&gt;This array provides optional metadata and attributes for the uploaded files&lt;br&gt;&lt;section&gt;  &lt;h3&gt;Each object in the array must contain:&lt;/h3&gt;    &lt;table&gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;th&gt;Field&lt;/th&gt;         &lt;th&gt;Type&lt;/th&gt;         &lt;th&gt;Description&lt;/th&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;&lt;code&gt;filename&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;Must match the filename of one of the uploaded files. Filenames must be unique in the upload request.&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td&gt;&lt;code&gt;fileAttributes&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;&lt;code&gt;JSON Object&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;Container for metadata and other file-specific attributes.&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;   &lt;/table&gt;    &lt;h4&gt;Inside &lt;code&gt;fileAttributes&lt;/code&gt;:&lt;/h4&gt;   &lt;table&gt;     &lt;thead&gt;       &lt;tr&gt;         &lt;th&gt;Field&lt;/th&gt;         &lt;th&gt;Type&lt;/th&gt;         &lt;th&gt;Description&lt;/th&gt;       &lt;/tr&gt;     &lt;/thead&gt;     &lt;tbody&gt;       &lt;tr&gt;         &lt;td&gt;&lt;code&gt;parentFolderId&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;&lt;code&gt;UUID&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;UUID of the target folder to upload the file (if not provided : the file will be uploaded at the root level)&lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;         &lt;td&gt;&lt;code&gt;metadata&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;&lt;code&gt;Map&amp;lt;String, JSON Object&amp;gt;&lt;/code&gt;&lt;/td&gt;         &lt;td&gt;Arbitrary metadata to associate with the file (key/value pairs).&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;   &lt;/table&gt;    &lt;h4&gt;Example of &lt;code&gt;parametersByFilename&lt;/code&gt; JSON array :&lt;/h4&gt;   &lt;pre&gt;&lt;code&gt;[   {     \\\&quot;filename\\\&quot;: \\\&quot;file1.txt\\\&quot;,     \\\&quot;fileAttributes\\\&quot;: {       \\\&quot;parentFolderId\\\&quot;: \\\&quot;f8c3de3d-1fea-4d7c-a8b0-29f63c4c3454\\\&quot;,       \\\&quot;metadata\\\&quot;: {         \\\&quot;country\\\&quot;: \\\&quot;UK\\\&quot;,         \\\&quot;owner\\\&quot;: {           \\\&quot;name\\\&quot;: \\\&quot;Joe\\\&quot;,           \\\&quot;owner_id\\\&quot;: 1234568         }       }     }   },   {     \\\&quot;filename\\\&quot;: \\\&quot;file2.md\\\&quot;,     \\\&quot;fileAttributes\\\&quot;: {       \\\&quot;metadata\\\&quot;: {         \\\&quot;key1\\\&quot;: \\\&quot;value1\\\&quot;,         \\\&quot;key2\\\&quot;: \\\&quot;value2\\\&quot;,         \\\&quot;key3\\\&quot;: \\\&quot;value3\\\&quot;       }     }   } ]&lt;/code&gt;&lt;/pre&gt; &lt;/section&gt; | (optional) defaults to undefined|


### Return type

**Array<UploadResponse>**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: multipart/form-data
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **uploadDocument1**
> UploadResponse uploadDocument1()

Uploads a single file, optionally with metadata and a parent folder ID.

### Example

```typescript
import {
    DocumentControllerApi,
    Configuration
} from '@openfilz-sdk/typescript';

const configuration = new Configuration();
const apiInstance = new DocumentControllerApi(configuration);

let file: File; // (default to undefined)
let allowDuplicateFileNames: boolean; //When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. (optional) (default to false)
let autoFile: boolean; //Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent = the user\'s own switch. Needs openfilz.ai.auto-file.active. (optional) (default to undefined)
let parentFolderId: string; //Target parent folder ID to store the file; if not sent or null, the file is stored at the root level (optional) (default to undefined)
let metadata: string; // (optional) (default to undefined)

const { status, data } = await apiInstance.uploadDocument1(
    file,
    allowDuplicateFileNames,
    autoFile,
    parentFolderId,
    metadata
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **file** | [**File**] |  | defaults to undefined|
| **allowDuplicateFileNames** | [**boolean**] | When true, the file is stored even if a document of the same name already exists in the target folder (nothing is overwritten). When false (default), a 409 is returned. | (optional) defaults to false|
| **autoFile** | [**boolean**] | Smart filing: true asks OpenFilz to choose the destination folder of the uploaded file(s) after the upload (a job id comes back in autoFile.jobId); false leaves them where they are; absent &#x3D; the user\&#39;s own switch. Needs openfilz.ai.auto-file.active. | (optional) defaults to undefined|
| **parentFolderId** | [**string**] | Target parent folder ID to store the file; if not sent or null, the file is stored at the root level | (optional) defaults to undefined|
| **metadata** | [**string**] |  | (optional) defaults to undefined|


### Return type

**UploadResponse**

### Authorization

[keycloak_auth](../README.md#keycloak_auth)

### HTTP request headers

 - **Content-Type**: multipart/form-data
 - **Accept**: */*


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | OK |  -  |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

