# DocumentInsightsApi

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

|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**backfill**](#backfill) | **POST** /api/v1/ai/insights/backfill | Enrich existing documents|
|[**backfillStatus**](#backfillstatus) | **GET** /api/v1/ai/insights/backfill/{jobId} | Progress of a backfill job|
|[**facets**](#facets) | **GET** /api/v1/ai/insights/facets | The category and language facets of the library|
|[**getInsights**](#getinsights) | **GET** /api/v1/documents/{documentId}/insights | Get the insights of a document|
|[**setCategory**](#setcategory) | **PATCH** /api/v1/documents/{documentId}/insights | Correct the kind of a document|

# **backfill**
> InsightBackfillStatus backfill()

Queues every FILE without a tier-2 insight (or with an older prompt version when force), optionally under one folder, and returns the job at once. Poll GET /backfill/{jobId}.

### Example

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

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

let insightBackfillRequest: InsightBackfillRequest; // (optional)

const { status, data } = await apiInstance.backfill(
    insightBackfillRequest
);
```

### Parameters

|Name | Type | Description  | Notes|
|------------- | ------------- | ------------- | -------------|
| **insightBackfillRequest** | **InsightBackfillRequest**|  | |


### Return type

**InsightBackfillStatus**

### Authorization

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

### HTTP request headers

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


### 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)

# **backfillStatus**
> InsightBackfillStatus backfillStatus()


### Example

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

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

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

const { status, data } = await apiInstance.backfillStatus(
    jobId
);
```

### Parameters

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


### Return type

**InsightBackfillStatus**

### Authorization

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

### HTTP request headers

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


### 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)

# **facets**
> InsightFacets facets()

How many active files carry each tier-2 category and each detected language, from the document insights (largest first). The keys are what searchDocuments accepts in its \'category\' / \'language\' filters. 404 when the AI features are off (openfilz.ai.active); READER.

### Example

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

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

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

### Parameters
This endpoint does not have any parameters.


### Return type

**InsightFacets**

### Authorization

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

### HTTP request headers

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


### 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)

# **getInsights**
> DocumentInsightView getInsights()

Tier 1: the file\'s own metadata (title, author, dates, page count, language) captured at upload. Tier 2: the AI-derived category, summary, keywords and entities when openfilz.ai.insights.active is on. 404 when the document is not visible or has no insights yet.

### Example

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

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

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

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

### Parameters

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


### Return type

**DocumentInsightView**

### Authorization

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

### HTTP request headers

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


### 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)

# **setCategory**
> DocumentInsightView setCategory(insightCategoryUpdate)

Sets the tier-2 category to one of the deployment\'s kinds (the category taxonomy: openfilz.ai.insights.categories, or \'other\'), recorded as written by the user: it is never overwritten by a non-forced backfill, it teaches the learned classifier, and the by-kind reorganisation and smart filing use it like a model\'s label. 400 for a kind the deployment does not know; 403 without modify access.

### Example

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

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

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

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

### Parameters

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


### Return type

**DocumentInsightView**

### Authorization

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

### HTTP request headers

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


### 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)

