# Service API
API for application services

## Version: 1.0

### Security
**Bearer**  

| apiKey | *API Key* |
| ------ | --------- |
| Description | Type: Bearer {your-api-key} |
| In | header |
| Name | Authorization |

---
## service_api
Service operations

### /

#### GET
##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Success | [IndexInfoResponse](#indexinforesponse) |

### /app/feedbacks

#### GET
##### Summary

Get all feedbacks for the application

##### Description

Get all feedbacks for the application
Returns paginated list of all feedback submitted for messages in this app.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [FeedbackListQuery](#feedbacklistquery) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Feedbacks retrieved successfully |
| 401 | Unauthorized - invalid API token |

### /apps/annotation-reply/{action}

#### POST
##### Summary

Enable or disable annotation reply feature

##### Description

Enable or disable annotation reply feature

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [AnnotationReplyActionPayload](#annotationreplyactionpayload) |
| action | path | Action to perform: 'enable' or 'disable' | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Action completed successfully |
| 401 | Unauthorized - invalid API token |

### /apps/annotation-reply/{action}/status/{job_id}

#### GET
##### Summary

Get the status of an annotation reply action job

##### Description

Get the status of an annotation reply action job

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| action | path | Action type | Yes | string |
| job_id | path | Job ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Job status retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Job not found |

### /apps/annotations

#### GET
##### Summary

List annotations for the application

##### Description

List annotations for the application

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| keyword | query | Keyword to search annotations | No | string |
| limit | query | Number of annotations per page | No | integer |
| page | query | Page number | No | integer |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Annotations retrieved successfully | [AnnotationList](#annotationlist) |
| 401 | Unauthorized - invalid API token |  |

#### POST
##### Summary

Create a new annotation

##### Description

Create a new annotation

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [AnnotationCreatePayload](#annotationcreatepayload) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 201 | Annotation created successfully | [Annotation](#annotation) |
| 401 | Unauthorized - invalid API token |  |

### /apps/annotations/{annotation_id}

#### DELETE
##### Summary

Delete an annotation

##### Description

Delete an annotation

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| annotation_id | path | Annotation ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Annotation deleted successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |
| 404 | Annotation not found |

#### PUT
##### Summary

Update an existing annotation

##### Description

Update an existing annotation

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [AnnotationCreatePayload](#annotationcreatepayload) |
| annotation_id | path | Annotation ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Annotation updated successfully | [Annotation](#annotation) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |
| 404 | Annotation not found |  |

### /audio-to-text

#### POST
##### Summary

Convert audio to text using speech-to-text

##### Description

Convert audio to text using speech-to-text
Accepts an audio file upload and returns the transcribed text.

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Audio successfully transcribed |
| 400 | Bad request - no audio or invalid audio |
| 401 | Unauthorized - invalid API token |
| 413 | Audio file too large |
| 415 | Unsupported audio type |
| 500 | Internal server error |

### /chat-messages

#### POST
##### Summary

Send a message in a chat conversation

##### Description

Send a message in a chat conversation
This endpoint handles chat messages for chat, agent chat, and advanced chat applications.
Supports conversation management and both blocking and streaming response modes.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ChatRequestPayload](#chatrequestpayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Message sent successfully |
| 400 | Bad request - invalid parameters or workflow issues |
| 401 | Unauthorized - invalid API token |
| 404 | Conversation or workflow not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |

### /chat-messages/{task_id}/stop

#### POST
##### Summary

Stop a running chat message generation

##### Description

Stop a running chat message generation

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| task_id | path | The ID of the task to stop | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Task stopped successfully | [SimpleResultResponse](#simpleresultresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Task not found |  |

### /completion-messages

#### POST
##### Summary

Create a completion for the given prompt

##### Description

Create a completion for the given prompt
This endpoint generates a completion based on the provided inputs and query.
Supports both blocking and streaming response modes.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [CompletionRequestPayload](#completionrequestpayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Completion created successfully |
| 400 | Bad request - invalid parameters |
| 401 | Unauthorized - invalid API token |
| 404 | Conversation not found |
| 500 | Internal server error |

### /completion-messages/{task_id}/stop

#### POST
##### Summary

Stop a running completion task

##### Description

Stop a running completion task

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| task_id | path | The ID of the task to stop | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Task stopped successfully | [SimpleResultResponse](#simpleresultresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Task not found |  |

### /conversations

#### GET
##### Summary

List all conversations for the current user

##### Description

List all conversations for the current user
Supports pagination using last_id and limit parameters.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ConversationListQuery](#conversationlistquery) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Conversations retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Last conversation not found |

### /conversations/{c_id}

#### DELETE
##### Summary

Delete a specific conversation

##### Description

Delete a specific conversation

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| c_id | path | Conversation ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Conversation deleted successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Conversation not found |

### /conversations/{c_id}/name

#### POST
##### Summary

Rename a conversation or auto-generate a name

##### Description

Rename a conversation or auto-generate a name

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ConversationRenamePayload](#conversationrenamepayload) |
| c_id | path | Conversation ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Conversation renamed successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Conversation not found |

### /conversations/{c_id}/variables

#### GET
##### Summary

List all variables for a conversation

##### Description

List all variables for a conversation
Conversational variables are only available for chat applications.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ConversationVariablesQuery](#conversationvariablesquery) |
| c_id | path | Conversation ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Variables retrieved successfully | [ConversationVariableInfiniteScrollPaginationResponse](#conversationvariableinfinitescrollpaginationresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Conversation not found |  |

### /conversations/{c_id}/variables/{variable_id}

#### PUT
##### Summary

Update a conversation variable's value

##### Description

Update a conversation variable's value
Allows updating the value of a specific conversation variable.
The value must match the variable's expected type.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ConversationVariableUpdatePayload](#conversationvariableupdatepayload) |
| c_id | path | Conversation ID | Yes | string |
| variable_id | path | Variable ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Variable updated successfully | [ConversationVariableResponse](#conversationvariableresponse) |
| 400 | Bad request - type mismatch |  |
| 401 | Unauthorized - invalid API token |  |
| 404 | Conversation or variable not found |  |

### /datasets

#### GET
##### Summary

Resource for getting datasets

##### Description

List all datasets

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| include_all | query | Include all datasets | No | boolean |
| keyword | query | Search keyword | No | string |
| limit | query | Number of items per page | No | integer |
| page | query | Page number | No | integer |
| tag_ids | query | Filter by tag IDs | No | [ string ] |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Datasets retrieved successfully | [DatasetListResponse](#datasetlistresponse) |
| 401 | Unauthorized - invalid API token |  |

#### POST
##### Summary

Resource for creating datasets

##### Description

Create a new dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DatasetCreatePayload](#datasetcreatepayload) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Dataset created successfully | [DatasetDetailResponse](#datasetdetailresponse) |
| 400 | Bad request - invalid parameters |  |
| 401 | Unauthorized - invalid API token |  |

### /datasets/pipeline/file-upload

#### POST
##### Summary

Upload a file for use in conversations

##### Description

Upload a file to a knowledgebase pipeline
Accepts a single file upload via multipart/form-data.

##### Responses

| Code | Description |
| ---- | ----------- |
| 201 | File uploaded successfully |
| 400 | Bad request - no file or invalid file |
| 401 | Unauthorized - invalid API token |
| 413 | File too large |
| 415 | Unsupported file type |

### /datasets/tags

#### DELETE
##### Summary

Delete a knowledge type tag

##### Description

Delete a knowledge type tag

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TagDeletePayload](#tagdeletepayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Tag deleted successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |

#### GET
##### Summary

Get all knowledge type tags

##### Description

Get all knowledge type tags

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Tags retrieved successfully | [KnowledgeTagListResponse](#knowledgetaglistresponse) |
| 401 | Unauthorized - invalid API token |  |

#### PATCH
##### Description

Update a knowledge type tag

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TagUpdatePayload](#tagupdatepayload) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Tag updated successfully | [KnowledgeTagResponse](#knowledgetagresponse) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |

#### POST
##### Summary

Add a knowledge type tag

##### Description

Add a knowledge type tag

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TagCreatePayload](#tagcreatepayload) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Tag created successfully | [KnowledgeTagResponse](#knowledgetagresponse) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |

### /datasets/tags/binding

#### POST
##### Description

Bind tags to a dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TagBindingPayload](#tagbindingpayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Tags bound successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |

### /datasets/tags/unbinding

#### POST
##### Description

Unbind tags from a dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TagUnbindingPayload](#tagunbindingpayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Tags unbound successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |

### /datasets/{dataset_id}

#### DELETE
##### Summary

Deletes a dataset given its ID

##### Description

Delete a dataset
Args:
    _: ignore
    dataset_id (UUID): The ID of the dataset to be deleted.

Returns:
    dict: A dictionary with a key 'result' and a value 'success'
          if the dataset was successfully deleted. Omitted in HTTP response.
    int: HTTP status code 204 indicating that the operation was successful.

Raises:
    NotFound: If the dataset with the given ID does not exist.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Dataset deleted successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Dataset not found |
| 409 | Conflict - dataset is in use |

#### GET
##### Description

Get a specific dataset by ID

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Dataset retrieved successfully | [DatasetDetailWithPartialMembersResponse](#datasetdetailwithpartialmembersresponse) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |
| 404 | Dataset not found |  |

#### PATCH
##### Description

Update an existing dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DatasetUpdatePayload](#datasetupdatepayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Dataset updated successfully | [DatasetDetailWithPartialMembersResponse](#datasetdetailwithpartialmembersresponse) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/document/create-by-file

#### POST
##### Description

Create a new document by uploading a file

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| data | formData | Optional JSON string with document creation settings. | No | string |
| file | formData | Document file to upload. | Yes | file |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document created successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 400 | Bad request - invalid file or parameters |  |
| 401 | Unauthorized - invalid API token |  |

### /datasets/{dataset_id}/document/create-by-text

#### POST
##### Description

Create a new document by providing text content

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DocumentTextCreatePayload](#documenttextcreatepayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document created successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 400 | Bad request - invalid parameters |  |
| 401 | Unauthorized - invalid API token |  |

### /datasets/{dataset_id}/document/create_by_file

#### POST
##### Description

Create a new document by uploading a file

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| data | formData | Optional JSON string with document creation settings. | No | string |
| file | formData | Document file to upload. | Yes | file |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document created successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 400 | Bad request - invalid file or parameters |  |
| 401 | Unauthorized - invalid API token |  |

### /datasets/{dataset_id}/document/create_by_text

#### POST
***DEPRECATED***
##### Description

Deprecated legacy alias for creating a new document by providing text content. Use /datasets/{dataset_id}/document/create-by-text instead.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DocumentTextCreatePayload](#documenttextcreatepayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document created successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 400 | Bad request - invalid parameters |  |
| 401 | Unauthorized - invalid API token |  |

### /datasets/{dataset_id}/documents

#### GET
##### Description

List all documents in a dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| keyword | query | Search keyword | No | string |
| limit | query | Number of items per page | No | integer |
| page | query | Page number | No | integer |
| status | query | Document status filter | No | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Documents retrieved successfully | [DocumentListResponse](#documentlistresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/documents/download-zip

#### POST
##### Description

Download selected uploaded documents as a single ZIP archive

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DocumentBatchDownloadZipPayload](#documentbatchdownloadzippayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | ZIP archive generated successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |
| 404 | Document or dataset not found |

### /datasets/{dataset_id}/documents/metadata

#### POST
##### Summary

Update metadata for multiple documents

##### Description

Update metadata for multiple documents

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [MetadataOperationData](#metadataoperationdata) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Documents metadata updated successfully | [DatasetMetadataActionResponse](#datasetmetadataactionresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/documents/status/{action}

#### PATCH
##### Summary

Batch update document status

##### Description

Batch update document status
Args:
    tenant_id: tenant id
    dataset_id: dataset id
    action: action to perform (Literal["enable", "disable", "archive", "un_archive"])

Returns:
    dict: A dictionary with a key 'result' and a value 'success'
    int: HTTP status code 200 indicating that the operation was successful.

Raises:
    NotFound: If the dataset with the given ID does not exist.
    Forbidden: If the user does not have permission.
    InvalidActionError: If the action is invalid or cannot be performed.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| action | path | Action to perform: 'enable', 'disable', 'archive', or 'un_archive' | Yes | string |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document status updated successfully | [SimpleResultResponse](#simpleresultresponse) |
| 400 | Bad request - invalid action |  |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/documents/{batch}/indexing-status

#### GET
##### Description

Get indexing status for documents in a batch

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| batch | path | Batch ID | Yes | string |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Indexing status retrieved successfully | [DocumentStatusListResponse](#documentstatuslistresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset or documents not found |  |

### /datasets/{dataset_id}/documents/{document_id}

#### DELETE
##### Summary

Delete document

##### Description

Delete a document

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Document deleted successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - document is archived |
| 404 | Document not found |

#### GET
##### Description

Get a specific document by ID

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Document retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - insufficient permissions |
| 404 | Document not found |

#### PATCH
##### Description

Update an existing document by uploading a file

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| data | formData | Optional JSON string with document update settings. | No | string |
| file | formData | Replacement document file. | No | file |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document updated successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Document not found |  |

### /datasets/{dataset_id}/documents/{document_id}/download

#### GET
##### Description

Get a signed download URL for a document's original uploaded file

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Download URL generated successfully | [UrlResponse](#urlresponse) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - insufficient permissions |  |
| 404 | Document or upload file not found |  |

### /datasets/{dataset_id}/documents/{document_id}/segments

#### GET
##### Description

List segments in a document

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| keyword | query |  | No | string |
| limit | query |  | No | integer |
| page | query |  | No | integer |
| status | query |  | No | [ string ] |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Segments retrieved successfully | [SegmentListResponse](#segmentlistresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset or document not found |  |

#### POST
##### Description

Create segments in a document

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [SegmentCreatePayload](#segmentcreatepayload) |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Segments created successfully | [SegmentCreateListResponse](#segmentcreatelistresponse) |
| 400 | Bad request - segments data is missing |  |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset or document not found |  |

### /datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}

#### DELETE
##### Description

Delete a specific segment

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Segment ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Segment deleted successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Dataset, document, or segment not found |

#### GET
##### Description

Get a specific segment by ID

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Segment ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Segment retrieved successfully | [SegmentDetailResponse](#segmentdetailresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset, document, or segment not found |  |

#### POST
##### Description

Update a specific segment

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [SegmentUpdatePayload](#segmentupdatepayload) |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Segment ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Segment updated successfully | [SegmentDetailResponse](#segmentdetailresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset, document, or segment not found |  |

### /datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks

#### GET
##### Description

List child chunks for a segment

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Parent segment ID | Yes | string |
| keyword | query |  | No | string |
| limit | query |  | No | integer |
| page | query |  | No | integer |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Child chunks retrieved successfully | [ChildChunkListResponse](#childchunklistresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset, document, or segment not found |  |

#### POST
##### Description

Create a new child chunk for a segment

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ChildChunkCreatePayload](#childchunkcreatepayload) |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Parent segment ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Child chunk created successfully | [ChildChunkDetailResponse](#childchunkdetailresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset, document, or segment not found |  |

### /datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_id}

#### DELETE
##### Description

Delete a specific child chunk

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| child_chunk_id | path | Child chunk ID | Yes | string |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Parent segment ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Child chunk deleted successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Dataset, document, segment, or child chunk not found |

#### PATCH
##### Description

Update a specific child chunk

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [ChildChunkUpdatePayload](#childchunkupdatepayload) |
| child_chunk_id | path | Child chunk ID | Yes | string |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |
| segment_id | path | Parent segment ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Child chunk updated successfully | [ChildChunkDetailResponse](#childchunkdetailresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset, document, segment, or child chunk not found |  |

### /datasets/{dataset_id}/documents/{document_id}/update-by-file

#### POST
***DEPRECATED***
##### Description

Deprecated legacy alias for updating an existing document by uploading a file. Use PATCH /datasets/{dataset_id}/documents/{document_id} instead.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| data | formData | Optional JSON string with document update settings. | No | string |
| file | formData | Replacement document file. | No | file |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document updated successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Document not found |  |

### /datasets/{dataset_id}/documents/{document_id}/update-by-text

#### POST
##### Description

Update an existing document by providing text content

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DocumentTextUpdate](#documenttextupdate) |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document updated successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Document not found |  |

### /datasets/{dataset_id}/documents/{document_id}/update_by_file

#### POST
***DEPRECATED***
##### Description

Deprecated legacy alias for updating an existing document by uploading a file. Use PATCH /datasets/{dataset_id}/documents/{document_id} instead.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| data | formData | Optional JSON string with document update settings. | No | string |
| file | formData | Replacement document file. | No | file |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document updated successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Document not found |  |

### /datasets/{dataset_id}/documents/{document_id}/update_by_text

#### POST
***DEPRECATED***
##### Description

Deprecated legacy alias for updating an existing document by providing text content. Use /datasets/{dataset_id}/documents/{document_id}/update-by-text instead.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [DocumentTextUpdate](#documenttextupdate) |
| dataset_id | path | Dataset ID | Yes | string |
| document_id | path | Document ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Document updated successfully | [DocumentAndBatchResponse](#documentandbatchresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Document not found |  |

### /datasets/{dataset_id}/hit-testing

#### POST
##### Summary

Perform hit testing on a dataset

##### Description

Perform hit testing on a dataset
Tests retrieval performance for the specified dataset.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [HitTestingPayload](#hittestingpayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Hit testing results | [HitTestingResponse](#hittestingresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/metadata

#### GET
##### Summary

Get all metadata for a dataset

##### Description

Get all metadata for a dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Metadata retrieved successfully | [DatasetMetadataListResponse](#datasetmetadatalistresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

#### POST
##### Summary

Create metadata for a dataset

##### Description

Create metadata for a dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [MetadataArgs](#metadataargs) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 201 | Metadata created successfully | [DatasetMetadataResponse](#datasetmetadataresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/metadata/built-in

#### GET
##### Summary

Get all built-in metadata fields

##### Description

Get all built-in metadata fields

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path |  | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Built-in fields retrieved successfully | [DatasetMetadataBuiltInFieldsResponse](#datasetmetadatabuiltinfieldsresponse) |
| 401 | Unauthorized - invalid API token |  |

### /datasets/{dataset_id}/metadata/built-in/{action}

#### POST
##### Summary

Enable or disable built-in metadata field

##### Description

Enable or disable built-in metadata field

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| action | path | Action to perform: 'enable' or 'disable' | Yes | string |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Action completed successfully | [DatasetMetadataActionResponse](#datasetmetadataactionresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/metadata/{metadata_id}

#### DELETE
##### Summary

Delete metadata

##### Description

Delete metadata

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |
| metadata_id | path | Metadata ID | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 204 | Metadata deleted successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Dataset or metadata not found |

#### PATCH
##### Summary

Update metadata name

##### Description

Update metadata name

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [MetadataUpdatePayload](#metadataupdatepayload) |
| dataset_id | path | Dataset ID | Yes | string |
| metadata_id | path | Metadata ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Metadata updated successfully | [DatasetMetadataResponse](#datasetmetadataresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset or metadata not found |  |

### /datasets/{dataset_id}/pipeline/datasource-plugins

#### GET
##### Summary

Resource for getting datasource plugins

##### Description

List all datasource plugins for a rag pipeline

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path |  | Yes | string |
| is_published | query | Whether to get published or draft datasource plugins (true for published, false for draft, default: true) | No | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Datasource plugins retrieved successfully |
| 401 | Unauthorized - invalid API token |

### /datasets/{dataset_id}/pipeline/datasource/nodes/{node_id}/run

#### POST
##### Summary

Resource for getting datasource plugins

##### Description

Run a datasource node for a rag pipeline

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path |  | Yes | string |
| node_id | path |  | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Datasource node run successfully |
| 401 | Unauthorized - invalid API token |

### /datasets/{dataset_id}/pipeline/run

#### POST
##### Summary

Resource for running a rag pipeline

##### Description

Run a datasource node for a rag pipeline

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path |  | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Pipeline run successfully |
| 401 | Unauthorized - invalid API token |

### /datasets/{dataset_id}/retrieve

#### POST
##### Summary

Perform hit testing on a dataset

##### Description

Perform hit testing on a dataset
Tests retrieval performance for the specified dataset.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [HitTestingPayload](#hittestingpayload) |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Hit testing results | [HitTestingResponse](#hittestingresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Dataset not found |  |

### /datasets/{dataset_id}/tags

#### GET
##### Summary

Get all knowledge type tags

##### Description

Get tags bound to a specific dataset

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| dataset_id | path | Dataset ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Tags retrieved successfully | [DatasetBoundTagListResponse](#datasetboundtaglistresponse) |
| 401 | Unauthorized - invalid API token |  |

### /end-users/{end_user_id}

#### GET
##### Summary

Get end user detail

##### Description

Get an end user by ID
This endpoint is scoped to the current app token's tenant/app to prevent
cross-tenant/app access when an end-user ID is known.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| end_user_id | path | End user ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | End user retrieved successfully | [EndUserDetail](#enduserdetail) |
| 401 | Unauthorized - invalid API token |  |
| 404 | End user not found |  |

### /files/upload

#### POST
##### Summary

Upload a file for use in conversations

##### Description

Upload a file for use in conversations
Accepts a single file upload via multipart/form-data.

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 201 | File uploaded successfully | [FileResponse](#fileresponse) |
| 400 | Bad request - no file or invalid file |  |
| 401 | Unauthorized - invalid API token |  |
| 413 | File too large |  |
| 415 | Unsupported file type |  |

### /files/{file_id}/preview

#### GET
##### Summary

Preview/Download a file that was uploaded via Service API

##### Description

Preview or download a file uploaded via Service API
Provides secure file preview/download functionality.
Files can only be accessed if they belong to messages within the requesting app's context.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [FilePreviewQuery](#filepreviewquery) |
| file_id | path | UUID of the file to preview | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | File retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 403 | Forbidden - file access denied |
| 404 | File not found |

### /form/human_input/{form_token}

#### GET
##### Description

Get a paused human input form by token

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| form_token | path | Human input form token | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Form retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Form not found |
| 412 | Form already submitted or expired |

#### POST
##### Description

Submit a paused human input form by token

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [HumanInputFormSubmitPayload](#humaninputformsubmitpayload) |
| form_token | path | Human input form token | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Form submitted successfully |
| 400 | Bad request - invalid submission data |
| 401 | Unauthorized - invalid API token |
| 404 | Form not found |
| 412 | Form already submitted or expired |

### /info

#### GET
##### Summary

Get app information

##### Description

Get basic application information
Returns basic information about the application including name, description, tags, and mode.

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Application info retrieved successfully | [AppInfoResponse](#appinforesponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Application not found |  |

### /messages

#### GET
##### Summary

List messages in a conversation

##### Description

List messages in a conversation
Retrieves messages with pagination support using first_id.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [MessageListQuery](#messagelistquery) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Messages retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Conversation or first message not found |

### /messages/{message_id}/feedbacks

#### POST
##### Summary

Submit feedback for a message

##### Description

Submit feedback for a message
Allows users to rate messages as like/dislike and provide optional feedback content.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [MessageFeedbackPayload](#messagefeedbackpayload) |
| message_id | path | Message ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Feedback submitted successfully | [ResultResponse](#resultresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Message not found |  |

### /messages/{message_id}/suggested

#### GET
##### Summary

Get suggested follow-up questions for a message

##### Description

Get suggested follow-up questions for a message
Returns AI-generated follow-up questions based on the message content.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| message_id | path | Message ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Suggested questions retrieved successfully | [SimpleResultStringListResponse](#simpleresultstringlistresponse) |
| 400 | Suggested questions feature is disabled |  |
| 401 | Unauthorized - invalid API token |  |
| 404 | Message not found |  |
| 500 | Internal server error |  |

### /meta

#### GET
##### Summary

Get app metadata

##### Description

Get application metadata
Returns metadata about the application including configuration and settings.

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Metadata retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Application not found |

### /parameters

#### GET
##### Summary

Retrieve app parameters

##### Description

Retrieve application input parameters and configuration
Returns the input form parameters and configuration for the application.

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Parameters retrieved successfully |
| 401 | Unauthorized - invalid API token |
| 404 | Application not found |

### /site

#### GET
##### Summary

Retrieve app site info

##### Description

Get application site configuration
Returns the site configuration for the application including theme, icons, and text.

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Site configuration retrieved successfully | [Site](#site) |
| 401 | Unauthorized - invalid API token |  |
| 403 | Forbidden - site not found or tenant archived |  |

### /text-to-audio

#### POST
##### Summary

Convert text to audio using text-to-speech

##### Description

Convert text to audio using text-to-speech
Converts the provided text to audio using the specified voice.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [TextToAudioPayload](#texttoaudiopayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Text successfully converted to audio |
| 400 | Bad request - invalid parameters |
| 401 | Unauthorized - invalid API token |
| 500 | Internal server error |

### /workflow/{task_id}/events

#### GET
##### Description

Get workflow execution events stream after resume

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| task_id | path | Workflow run ID | Yes | string |
| continue_on_pause | query | Whether to keep the stream open across workflow_paused events,specify `"true"` to keep the stream open for `workflow_paused` events. | No | string |
| include_state_snapshot | query | Whether to replay from persisted state snapshot, specify `"true"` to include a status snapshot of executed nodes | No | string |
| user | query | End user identifier (query param) | No | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | SSE event stream |
| 401 | Unauthorized - invalid API token |
| 404 | Workflow run not found |

### /workflows/logs

#### GET
##### Summary

Get workflow app logs

##### Description

Get workflow execution logs
Returns paginated workflow execution logs with filtering options.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [WorkflowLogQuery](#workflowlogquery) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Logs retrieved successfully | [WorkflowAppLogPaginationResponse](#workflowapplogpaginationresponse) |
| 401 | Unauthorized - invalid API token |  |

### /workflows/run

#### POST
##### Summary

Execute a workflow

##### Description

Execute a workflow
Runs a workflow with the provided inputs and returns the results.
Supports both blocking and streaming response modes.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [WorkflowRunPayload](#workflowrunpayload) |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Workflow executed successfully |
| 400 | Bad request - invalid parameters or workflow issues |
| 401 | Unauthorized - invalid API token |
| 404 | Workflow not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |

### /workflows/run/{workflow_run_id}

#### GET
##### Summary

Get a workflow task running detail

##### Description

Get workflow run details
Returns detailed information about a specific workflow run.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| workflow_run_id | path | Workflow run ID | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Workflow run details retrieved successfully | [WorkflowRunResponse](#workflowrunresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Workflow run not found |  |

### /workflows/tasks/{task_id}/stop

#### POST
##### Summary

Stop a running workflow task

##### Description

Stop a running workflow task

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| task_id | path | Task ID to stop | Yes | string |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | Task stopped successfully | [SimpleResultResponse](#simpleresultresponse) |
| 401 | Unauthorized - invalid API token |  |
| 404 | Task not found |  |

### /workflows/{workflow_id}/run

#### POST
##### Summary

Run specific workflow by ID

##### Description

Execute a specific workflow by ID
Executes a specific workflow version identified by its ID.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| payload | body |  | Yes | [WorkflowRunPayload](#workflowrunpayload) |
| workflow_id | path | Workflow ID to execute | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Workflow executed successfully |
| 400 | Bad request - invalid parameters or workflow issues |
| 401 | Unauthorized - invalid API token |
| 404 | Workflow not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |

### /workspaces/current/models/model-types/{model_type}

#### GET
##### Summary

Get available models by model type

##### Description

Get available models by model type
Returns a list of available models for the specified model type.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| model_type | path | Type of model to retrieve | Yes | string |

##### Responses

| Code | Description |
| ---- | ----------- |
| 200 | Models retrieved successfully |
| 401 | Unauthorized - invalid API token |

---
### Models

#### Annotation

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | No |
| created_at | integer |  | No |
| hit_count | integer |  | No |
| id | string |  | Yes |
| question | string |  | No |

#### AnnotationCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| answer | string | Annotation answer | Yes |
| question | string | Annotation question | Yes |

#### AnnotationList

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [Annotation](#annotation) ] |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |

#### AnnotationListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword | string | Keyword to search annotations | No |
| limit | integer | Number of annotations per page | No |
| page | integer | Page number | No |

#### AnnotationReplyActionPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| embedding_model_name | string | Embedding model name | Yes |
| embedding_provider_name | string | Embedding provider name | Yes |
| score_threshold | number | Score threshold for annotation matching | Yes |

#### AppInfoResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| author_name | string |  | Yes |
| description | string |  | Yes |
| mode | string |  | Yes |
| name | string |  | Yes |
| tags | [ string ] |  | Yes |

#### ChatRequestPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| auto_generate_name | boolean | Auto generate conversation name | No |
| conversation_id | string | Conversation UUID | No |
| files | [ object ] |  | No |
| inputs | object |  | Yes |
| query | string |  | Yes |
| response_mode | string | *Enum:* `"blocking"`, `"streaming"` | No |
| retriever_from | string |  | No |
| trace_session_id | string | Trace session ID for observability grouping | No |
| workflow_id | string | Workflow ID for advanced chat | No |

#### ChildChunkCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | Yes |

#### ChildChunkDetailResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ChildChunkResponse](#childchunkresponse) |  | Yes |

#### ChildChunkListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword | string |  | No |
| limit | integer |  | No |
| page | integer |  | No |

#### ChildChunkListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [ChildChunkResponse](#childchunkresponse) ] |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |
| total_pages | integer |  | Yes |

#### ChildChunkResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | Yes |
| created_at | integer |  | Yes |
| id | string |  | Yes |
| position | integer |  | Yes |
| segment_id | string |  | Yes |
| type | string |  | Yes |
| updated_at | integer |  | Yes |
| word_count | integer |  | Yes |

#### ChildChunkUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | Yes |

#### CompletionRequestPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| files | [ object ] |  | No |
| inputs | object |  | Yes |
| query | string |  | No |
| response_mode | string | *Enum:* `"blocking"`, `"streaming"` | No |
| retriever_from | string |  | No |
| trace_session_id | string | Trace session ID for observability grouping | No |

#### Condition

Condition detail

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| comparison_operator | string | *Enum:* `"<"`, `"="`, `">"`, `"after"`, `"before"`, `"contains"`, `"empty"`, `"end with"`, `"in"`, `"is"`, `"is not"`, `"not contains"`, `"not empty"`, `"not in"`, `"start with"`, `"≠"`, `"≤"`, `"≥"` | Yes |
| name | string |  | Yes |
| value | string<br>[ string ]<br>integer<br>number |  | No |

#### ConversationListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| last_id | string | Last conversation ID for pagination | No |
| limit | integer | Number of conversations to return | No |
| sort_by | string | Sort order for conversations<br>*Enum:* `"-created_at"`, `"-updated_at"`, `"created_at"`, `"updated_at"` | No |

#### ConversationRenamePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| auto_generate | boolean |  | No |
| name | string |  | No |

#### ConversationVariableInfiniteScrollPaginationResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [ConversationVariableResponse](#conversationvariableresponse) ] |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |

#### ConversationVariableResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer |  | No |
| description | string |  | No |
| id | string |  | Yes |
| name | string |  | Yes |
| updated_at | integer |  | No |
| value | string |  | No |
| value_type | string |  | Yes |

#### ConversationVariableUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| value |  |  | Yes |

#### ConversationVariablesQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| last_id | string | Last variable ID for pagination | No |
| limit | integer | Number of variables to return | No |
| variable_name | string | Filter variables by name | No |

#### DatasetBoundTagListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [DatasetBoundTagResponse](#datasetboundtagresponse) ] |  | Yes |
| total | integer |  | Yes |

#### DatasetBoundTagResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |

#### DatasetCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | string | Dataset description (max 400 chars) | No |
| embedding_model | string |  | No |
| embedding_model_provider | string |  | No |
| external_knowledge_api_id | string |  | No |
| external_knowledge_id | string |  | No |
| indexing_technique | string | *Enum:* `"economy"`, `"high_quality"` | No |
| name | string |  | Yes |
| permission | [PermissionEnum](#permissionenum) |  | No |
| provider | string |  | No |
| retrieval_model | [RetrievalModel](#retrievalmodel) |  | No |
| summary_index_setting | object |  | No |

#### DatasetDetailResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_count | integer |  | Yes |
| author_name | string |  | Yes |
| built_in_field_enabled | boolean |  | Yes |
| chunk_structure | string |  | Yes |
| created_at | integer |  | Yes |
| created_by | string |  | Yes |
| data_source_type | string |  | Yes |
| description | string |  | Yes |
| doc_form | string |  | Yes |
| doc_metadata | [ [DatasetDocMetadataResponse](#datasetdocmetadataresponse) ] |  | Yes |
| document_count | integer |  | Yes |
| embedding_available | boolean |  | No |
| embedding_model | string |  | Yes |
| embedding_model_provider | string |  | Yes |
| enable_api | boolean |  | Yes |
| external_knowledge_info | [DatasetExternalKnowledgeInfoResponse](#datasetexternalknowledgeinforesponse) |  | No |
| external_retrieval_model | [DatasetExternalRetrievalModelResponse](#datasetexternalretrievalmodelresponse) |  | Yes |
| icon_info | [DatasetIconInfoResponse](#dataseticoninforesponse) |  | No |
| id | string |  | Yes |
| indexing_technique | string |  | Yes |
| is_multimodal | boolean |  | Yes |
| is_published | boolean |  | Yes |
| name | string |  | Yes |
| permission | string |  | Yes |
| pipeline_id | string |  | Yes |
| provider | string |  | Yes |
| retrieval_model_dict | [DatasetRetrievalModelResponse](#datasetretrievalmodelresponse) |  | Yes |
| runtime_mode | string |  | Yes |
| summary_index_setting | [DatasetSummaryIndexSettingResponse](#datasetsummaryindexsettingresponse) |  | No |
| tags | [ [DatasetTagResponse](#datasettagresponse) ] |  | Yes |
| total_available_documents | integer |  | Yes |
| total_documents | integer |  | Yes |
| updated_at | integer |  | Yes |
| updated_by | string |  | Yes |
| word_count | integer |  | Yes |

#### DatasetDetailWithPartialMembersResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_count | integer |  | Yes |
| author_name | string |  | Yes |
| built_in_field_enabled | boolean |  | Yes |
| chunk_structure | string |  | Yes |
| created_at | integer |  | Yes |
| created_by | string |  | Yes |
| data_source_type | string |  | Yes |
| description | string |  | Yes |
| doc_form | string |  | Yes |
| doc_metadata | [ [DatasetDocMetadataResponse](#datasetdocmetadataresponse) ] |  | Yes |
| document_count | integer |  | Yes |
| embedding_available | boolean |  | No |
| embedding_model | string |  | Yes |
| embedding_model_provider | string |  | Yes |
| enable_api | boolean |  | Yes |
| external_knowledge_info | [DatasetExternalKnowledgeInfoResponse](#datasetexternalknowledgeinforesponse) |  | No |
| external_retrieval_model | [DatasetExternalRetrievalModelResponse](#datasetexternalretrievalmodelresponse) |  | Yes |
| icon_info | [DatasetIconInfoResponse](#dataseticoninforesponse) |  | No |
| id | string |  | Yes |
| indexing_technique | string |  | Yes |
| is_multimodal | boolean |  | Yes |
| is_published | boolean |  | Yes |
| name | string |  | Yes |
| partial_member_list | [ string ] |  | No |
| permission | string |  | Yes |
| pipeline_id | string |  | Yes |
| provider | string |  | Yes |
| retrieval_model_dict | [DatasetRetrievalModelResponse](#datasetretrievalmodelresponse) |  | Yes |
| runtime_mode | string |  | Yes |
| summary_index_setting | [DatasetSummaryIndexSettingResponse](#datasetsummaryindexsettingresponse) |  | No |
| tags | [ [DatasetTagResponse](#datasettagresponse) ] |  | Yes |
| total_available_documents | integer |  | Yes |
| total_documents | integer |  | Yes |
| updated_at | integer |  | Yes |
| updated_by | string |  | Yes |
| word_count | integer |  | Yes |

#### DatasetDocMetadataResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |

#### DatasetExternalKnowledgeInfoResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| external_knowledge_api_endpoint | string |  | No |
| external_knowledge_api_id | string |  | No |
| external_knowledge_api_name | string |  | No |
| external_knowledge_id | string |  | No |

#### DatasetExternalRetrievalModelResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| score_threshold | number |  | No |
| score_threshold_enabled | boolean |  | No |
| top_k | integer |  | Yes |

#### DatasetIconInfoResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| icon | string |  | No |
| icon_background | string |  | No |
| icon_type | string |  | No |
| icon_url | string |  | No |

#### DatasetKeywordSettingResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword_weight | number |  | No |

#### DatasetListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| include_all | boolean | Include all datasets | No |
| keyword | string | Search keyword | No |
| limit | integer | Number of items per page | No |
| page | integer | Page number | No |
| tag_ids | [ string ] | Filter by tag IDs | No |

#### DatasetListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [DatasetDetailResponse](#datasetdetailresponse) ] |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |

#### DatasetMetadataActionResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| result | string |  | Yes |

#### DatasetMetadataBuiltInFieldResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string |  | Yes |
| type | string |  | Yes |

#### DatasetMetadataBuiltInFieldsResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| fields | [ [DatasetMetadataBuiltInFieldResponse](#datasetmetadatabuiltinfieldresponse) ] |  | Yes |

#### DatasetMetadataListItemResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| count | integer |  | No |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |

#### DatasetMetadataListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| built_in_field_enabled | boolean |  | Yes |
| doc_metadata | [ [DatasetMetadataListItemResponse](#datasetmetadatalistitemresponse) ] |  | Yes |

#### DatasetMetadataResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |

#### DatasetRerankingModelResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| reranking_model_name | string |  | No |
| reranking_provider_name | string |  | No |

#### DatasetRetrievalModelResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| reranking_enable | boolean |  | Yes |
| reranking_mode | string |  | No |
| reranking_model | [DatasetRerankingModelResponse](#datasetrerankingmodelresponse) |  | No |
| score_threshold | number |  | No |
| score_threshold_enabled | boolean |  | Yes |
| search_method | string |  | Yes |
| top_k | integer |  | Yes |
| weights | [DatasetWeightedScoreResponse](#datasetweightedscoreresponse) |  | No |

#### DatasetSummaryIndexSettingResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enable | boolean |  | No |
| model_name | string |  | No |
| model_provider_name | string |  | No |
| summary_prompt | string |  | No |

#### DatasetTagResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |

#### DatasetUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| description | string | Dataset description (max 400 chars) | No |
| embedding_model | string |  | No |
| embedding_model_provider | string |  | No |
| external_knowledge_api_id | string |  | No |
| external_knowledge_id | string |  | No |
| external_retrieval_model | object |  | No |
| indexing_technique | string | *Enum:* `"economy"`, `"high_quality"` | No |
| name | string |  | No |
| partial_member_list | [ object ] |  | No |
| permission | [PermissionEnum](#permissionenum) |  | No |
| retrieval_model | [RetrievalModel](#retrievalmodel) |  | No |

#### DatasetVectorSettingResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| embedding_model_name | string |  | No |
| embedding_provider_name | string |  | No |
| vector_weight | number |  | No |

#### DatasetWeightedScoreResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword_setting | [DatasetKeywordSettingResponse](#datasetkeywordsettingresponse) |  | No |
| vector_setting | [DatasetVectorSettingResponse](#datasetvectorsettingresponse) |  | No |
| weight_type | string |  | No |

#### DatasourceNodeRunPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| credential_id | string |  | No |
| datasource_type | string |  | Yes |
| inputs | object |  | Yes |
| is_published | boolean |  | Yes |

#### DocumentAndBatchResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| batch | string |  | Yes |
| document | [DocumentResponse](#documentresponse) |  | Yes |

#### DocumentBatchDownloadZipPayload

Request payload for bulk downloading documents as a zip archive.

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| document_ids | [ string (uuid) ] |  | Yes |

#### DocumentListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword | string | Search keyword | No |
| limit | integer | Number of items per page | No |
| page | integer | Page number | No |
| status | string | Document status filter | No |

#### DocumentListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [DocumentResponse](#documentresponse) ] |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |

#### DocumentMetadataOperation

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| document_id | string |  | Yes |
| metadata_list | [ [MetadataDetail](#metadatadetail) ] |  | Yes |
| partial_update | boolean |  | No |

#### DocumentMetadataResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |
| value | string<br>integer<br>number<br>boolean |  | No |

#### DocumentResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| archived | boolean |  | No |
| created_at | integer |  | No |
| created_by | string |  | No |
| created_from | string |  | No |
| data_source_detail_dict |  |  | No |
| data_source_info |  |  | No |
| data_source_type | string |  | No |
| dataset_process_rule_id | string |  | No |
| disabled_at | integer |  | No |
| disabled_by | string |  | No |
| display_status | string |  | No |
| doc_form | string |  | No |
| doc_metadata | [ [DocumentMetadataResponse](#documentmetadataresponse) ] |  | No |
| enabled | boolean |  | No |
| error | string |  | No |
| hit_count | integer |  | No |
| id | string |  | Yes |
| indexing_status | string |  | No |
| name | string |  | Yes |
| need_summary | boolean |  | No |
| position | integer |  | No |
| summary_index_status | string |  | No |
| tokens | integer |  | No |
| word_count | integer |  | No |

#### DocumentStatusListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [DocumentStatusResponse](#documentstatusresponse) ] |  | Yes |

#### DocumentStatusResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| cleaning_completed_at | integer |  | Yes |
| completed_at | integer |  | Yes |
| completed_segments | integer |  | No |
| error | string |  | Yes |
| id | string |  | Yes |
| indexing_status | string |  | Yes |
| parsing_completed_at | integer |  | Yes |
| paused_at | integer |  | Yes |
| processing_started_at | integer |  | Yes |
| splitting_completed_at | integer |  | Yes |
| stopped_at | integer |  | Yes |
| total_segments | integer |  | No |

#### DocumentTextCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| doc_form | string |  | No |
| doc_language | string |  | No |
| embedding_model | string |  | No |
| embedding_model_provider | string |  | No |
| indexing_technique | string |  | No |
| name | string |  | Yes |
| original_document_id | string |  | No |
| process_rule | [ProcessRule](#processrule) |  | No |
| retrieval_model | [RetrievalModel](#retrievalmodel) |  | No |
| text | string |  | Yes |

#### DocumentTextUpdate

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| doc_form | string |  | No |
| doc_language | string |  | No |
| name | string |  | No |
| process_rule | [ProcessRule](#processrule) |  | No |
| retrieval_model | [RetrievalModel](#retrievalmodel) |  | No |
| text | string |  | No |

#### EndUserDetail

Full EndUser record for API responses.

Note: The SQLAlchemy model defines an `is_anonymous` property for Flask-Login semantics
(always False). The database column is exposed as `_is_anonymous`, so this DTO maps
`is_anonymous` from `_is_anonymous` to return the stored value.

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| app_id | string |  | No |
| created_at | dateTime |  | Yes |
| external_user_id | string |  | No |
| id | string |  | Yes |
| is_anonymous | boolean |  | Yes |
| name | string |  | No |
| session_id | string |  | Yes |
| tenant_id | string |  | Yes |
| type | string |  | Yes |
| updated_at | dateTime |  | Yes |

#### FeedbackListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| limit | integer | Number of feedbacks per page | No |
| page | integer | Page number | No |

#### FilePreviewQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| as_attachment | boolean | Download as attachment | No |

#### FileResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| conversation_id | string |  | No |
| created_at | integer |  | No |
| created_by | string |  | No |
| extension | string |  | No |
| file_key | string |  | No |
| id | string |  | Yes |
| mime_type | string |  | No |
| name | string |  | Yes |
| original_url | string |  | No |
| preview_url | string |  | No |
| size | integer |  | Yes |
| source_url | string |  | No |
| tenant_id | string |  | No |
| user_id | string |  | No |

#### HitTestingChildChunk

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | Yes |
| id | string |  | Yes |
| position | integer |  | Yes |
| score | number |  | Yes |

#### HitTestingDocument

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data_source_type | string |  | Yes |
| doc_metadata |  |  | Yes |
| doc_type | string |  | Yes |
| id | string |  | Yes |
| name | string |  | Yes |

#### HitTestingFile

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| extension | string |  | Yes |
| id | string |  | Yes |
| mime_type | string |  | Yes |
| name | string |  | Yes |
| size | integer |  | Yes |
| source_url | string |  | Yes |

#### HitTestingPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| attachment_ids | [ string ] |  | No |
| external_retrieval_model | object |  | No |
| query | string |  | Yes |
| retrieval_model | [RetrievalModel](#retrievalmodel) |  | No |

#### HitTestingQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | Yes |

#### HitTestingRecord

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| child_chunks | [ [HitTestingChildChunk](#hittestingchildchunk) ] |  | Yes |
| files | [ [HitTestingFile](#hittestingfile) ] |  | Yes |
| score | number |  | Yes |
| segment | [HitTestingSegment](#hittestingsegment) |  | Yes |
| summary | string |  | Yes |
| tsne_position |  |  | Yes |

#### HitTestingResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| query | [HitTestingQuery](#hittestingquery) |  | Yes |
| records | [ [HitTestingRecord](#hittestingrecord) ] |  | Yes |

#### HitTestingSegment

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| answer | string |  | Yes |
| completed_at | integer |  | Yes |
| content | string |  | Yes |
| created_at | integer |  | Yes |
| created_by | string |  | Yes |
| disabled_at | integer |  | Yes |
| disabled_by | string |  | Yes |
| document | [HitTestingDocument](#hittestingdocument) |  | Yes |
| document_id | string |  | Yes |
| enabled | boolean |  | Yes |
| error | string |  | Yes |
| hit_count | integer |  | Yes |
| id | string |  | Yes |
| index_node_hash | string |  | Yes |
| index_node_id | string |  | Yes |
| indexing_at | integer |  | Yes |
| keywords | [ string ] |  | Yes |
| position | integer |  | Yes |
| sign_content | string |  | Yes |
| status | string |  | Yes |
| stopped_at | integer |  | Yes |
| tokens | integer |  | Yes |
| word_count | integer |  | Yes |

#### HumanInputFormSubmitPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| action | string |  | Yes |
| inputs | object | Submitted human input values keyed by output variable name. Use a string for paragraph or select input values, a file mapping for file inputs, and a list of file mappings for file-list inputs. Local file mappings use `transfer_method=local_file` with `upload_file_id`; remote file mappings use `transfer_method=remote_url` with `url` or `remote_url`. | Yes |

#### IndexInfoResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| api_version | string |  | Yes |
| server_version | string |  | Yes |
| welcome | string |  | Yes |

#### JsonValue

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| JsonValue |  |  |  |

#### KnowledgeTagListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| KnowledgeTagListResponse | array |  |  |

#### KnowledgeTagResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| binding_count | string |  | No |
| id | string |  | Yes |
| name | string |  | Yes |
| type | string |  | Yes |

#### MessageFeedbackPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| content | string |  | No |
| rating | string | *Enum:* `"dislike"`, `"like"` | No |

#### MessageListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| conversation_id | string | Conversation UUID | Yes |
| first_id | string | First message ID for pagination | No |
| limit | integer | Number of messages to return (1-100) | No |

#### MetadataArgs

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string |  | Yes |
| type | string | *Enum:* `"number"`, `"string"`, `"time"` | Yes |

#### MetadataDetail

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| name | string |  | Yes |
| value | string<br>integer<br>number |  | No |

#### MetadataFilteringCondition

Metadata Filtering Condition.

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| conditions | [ [Condition](#condition) ] |  | No |
| logical_operator | string | *Enum:* `"and"`, `"or"` | No |

#### MetadataOperationData

Metadata operation data

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| operation_data | [ [DocumentMetadataOperation](#documentmetadataoperation) ] |  | Yes |

#### MetadataUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string |  | Yes |

#### PermissionEnum

Shared permission levels for resources (datasets, credentials, etc.)

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| PermissionEnum | string | Shared permission levels for resources (datasets, credentials, etc.) |  |

#### PipelineRunApiEntity

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| datasource_info_list | [ object ] |  | Yes |
| datasource_type | string |  | Yes |
| inputs | object |  | Yes |
| is_published | boolean |  | Yes |
| response_mode | string |  | Yes |
| start_node_id | string |  | Yes |

#### PreProcessingRule

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| enabled | boolean |  | Yes |
| id | string |  | Yes |

#### ProcessRule

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| mode | string | *Enum:* `"automatic"`, `"custom"`, `"hierarchical"` | Yes |
| rules | [Rule](#rule) |  | No |

#### RerankingModel

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| reranking_model_name | string |  | No |
| reranking_provider_name | string |  | No |

#### ResultResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| result | string |  | Yes |

#### RetrievalMethod

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| RetrievalMethod | string |  |  |

#### RetrievalModel

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| metadata_filtering_conditions | [MetadataFilteringCondition](#metadatafilteringcondition) |  | No |
| reranking_enable | boolean |  | Yes |
| reranking_mode | string |  | No |
| reranking_model | [RerankingModel](#rerankingmodel) |  | No |
| score_threshold | number |  | No |
| score_threshold_enabled | boolean |  | Yes |
| search_method | [RetrievalMethod](#retrievalmethod) |  | Yes |
| top_k | integer |  | Yes |
| weights | [WeightModel](#weightmodel) |  | No |

#### Rule

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| parent_mode | string | *Enum:* `"full-doc"`, `"paragraph"` | No |
| pre_processing_rules | [ [PreProcessingRule](#preprocessingrule) ] |  | No |
| segmentation | [Segmentation](#segmentation) |  | No |
| subchunk_segmentation | [Segmentation](#segmentation) |  | No |

#### SegmentAttachmentResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| extension | string |  | Yes |
| id | string |  | Yes |
| mime_type | string |  | Yes |
| name | string |  | Yes |
| size | integer |  | Yes |
| source_url | string |  | Yes |

#### SegmentCreateItemPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| answer | string |  | No |
| attachment_ids | [ string ] |  | No |
| content | string |  | Yes |
| keywords | [ string ] |  | No |

#### SegmentCreateListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [SegmentResponse](#segmentresponse) ] |  | Yes |
| doc_form | string |  | Yes |

#### SegmentCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| segments | [ [SegmentCreateItemPayload](#segmentcreateitempayload) ] |  | Yes |

#### SegmentDetailResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [SegmentResponse](#segmentresponse) |  | Yes |
| doc_form | string |  | Yes |

#### SegmentListQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword | string |  | No |
| limit | integer |  | No |
| page | integer |  | No |
| status | [ string ] |  | No |

#### SegmentListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [SegmentResponse](#segmentresponse) ] |  | Yes |
| doc_form | string |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |

#### SegmentResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| answer | string |  | Yes |
| attachments | [ [SegmentAttachmentResponse](#segmentattachmentresponse) ] |  | Yes |
| child_chunks | [ [ChildChunkResponse](#childchunkresponse) ] |  | Yes |
| completed_at | integer |  | Yes |
| content | string |  | Yes |
| created_at | integer |  | Yes |
| created_by | string |  | Yes |
| disabled_at | integer |  | Yes |
| disabled_by | string |  | Yes |
| document_id | string |  | Yes |
| enabled | boolean |  | Yes |
| error | string |  | Yes |
| hit_count | integer |  | Yes |
| id | string |  | Yes |
| index_node_hash | string |  | Yes |
| index_node_id | string |  | Yes |
| indexing_at | integer |  | Yes |
| keywords | [ string ] |  | Yes |
| position | integer |  | Yes |
| sign_content | string |  | Yes |
| status | string |  | Yes |
| stopped_at | integer |  | Yes |
| summary | string |  | Yes |
| tokens | integer |  | Yes |
| updated_at | integer |  | Yes |
| updated_by | string |  | Yes |
| word_count | integer |  | Yes |

#### SegmentUpdateArgs

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| answer | string |  | No |
| attachment_ids | [ string ] |  | No |
| content | string |  | No |
| enabled | boolean |  | No |
| keywords | [ string ] |  | No |
| regenerate_child_chunks | boolean |  | No |
| summary | string |  | No |

#### SegmentUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| segment | [SegmentUpdateArgs](#segmentupdateargs) |  | Yes |

#### Segmentation

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| chunk_overlap | integer |  | No |
| max_tokens | integer |  | Yes |
| separator | string |  | No |

#### SimpleAccount

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| email | string |  | Yes |
| id | string |  | Yes |
| name | string |  | Yes |

#### SimpleEndUser

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| id | string |  | Yes |
| is_anonymous | boolean |  | Yes |
| session_id | string |  | No |
| type | string |  | Yes |

#### SimpleResultResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| result | string |  | Yes |

#### SimpleResultStringListResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ string ] |  | Yes |
| result | string |  | Yes |

#### Site

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| chat_color_theme | string |  | No |
| chat_color_theme_inverted | boolean |  | Yes |
| copyright | string |  | No |
| custom_disclaimer | string |  | No |
| default_language | string |  | Yes |
| description | string |  | No |
| icon | string |  | No |
| icon_background | string |  | No |
| icon_type | string |  | No |
| icon_url | string |  | Yes |
| privacy_policy | string |  | No |
| show_workflow_steps | boolean |  | Yes |
| title | string |  | Yes |
| use_icon_as_answer_icon | boolean |  | Yes |

#### TagBindingPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| tag_ids | [ string ] |  | Yes |
| target_id | string |  | Yes |

#### TagCreatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string |  | Yes |

#### TagDeletePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| tag_id | string |  | Yes |

#### TagUnbindingPayload

Accept the legacy single-tag Service API payload while exposing a normalized tag_ids list internally.

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| tag_id | string |  | No |
| tag_ids | [ string ] |  | No |
| target_id | string |  | Yes |

#### TagUpdatePayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| name | string |  | Yes |
| tag_id | string |  | Yes |

#### TextToAudioPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| message_id | string | Message ID | No |
| streaming | boolean | Enable streaming response | No |
| text | string | Text to convert to audio | No |
| voice | string | Voice to use for TTS | No |

#### UrlResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| url | string |  | Yes |

#### WeightKeywordSetting

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword_weight | number |  | Yes |

#### WeightModel

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| keyword_setting | [WeightKeywordSetting](#weightkeywordsetting) |  | No |
| vector_setting | [WeightVectorSetting](#weightvectorsetting) |  | No |
| weight_type | string | *Enum:* `"customized"`, `"keyword_first"`, `"semantic_first"` | No |

#### WeightVectorSetting

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| embedding_model_name | string |  | Yes |
| embedding_provider_name | string |  | Yes |
| vector_weight | number |  | Yes |

#### WorkflowAppLogPaginationResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| data | [ [WorkflowAppLogPartialResponse](#workflowapplogpartialresponse) ] |  | Yes |
| has_more | boolean |  | Yes |
| limit | integer |  | Yes |
| page | integer |  | Yes |
| total | integer |  | Yes |

#### WorkflowAppLogPartialResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer |  | No |
| created_by_account | [SimpleAccount](#simpleaccount) |  | No |
| created_by_end_user | [SimpleEndUser](#simpleenduser) |  | No |
| created_by_role | string |  | No |
| created_from | string |  | No |
| details | object<br>[ object ]<br>string<br>integer<br>number<br>boolean |  | No |
| id | string |  | Yes |
| workflow_run | [WorkflowRunForLogResponse](#workflowrunforlogresponse) |  | No |

#### WorkflowLogQuery

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at__after | string |  | No |
| created_at__before | string |  | No |
| created_by_account | string |  | No |
| created_by_end_user_session_id | string |  | No |
| keyword | string |  | No |
| limit | integer |  | No |
| page | integer |  | No |
| status | string | *Enum:* `"failed"`, `"stopped"`, `"succeeded"` | No |

#### WorkflowRunForLogResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer |  | No |
| elapsed_time | number<br>integer |  | No |
| error | string |  | No |
| exceptions_count | integer |  | No |
| finished_at | integer |  | No |
| id | string |  | Yes |
| status | string |  | No |
| total_steps | integer |  | No |
| total_tokens | integer |  | No |
| triggered_from | string |  | No |
| version | string |  | No |

#### WorkflowRunPayload

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| files | [ object ] |  | No |
| inputs | object |  | Yes |
| response_mode | string | *Enum:* `"blocking"`, `"streaming"` | No |
| trace_session_id | string | Trace session ID for observability grouping | No |

#### WorkflowRunResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| created_at | integer |  | No |
| elapsed_time | number<br>integer |  | No |
| error | string |  | No |
| finished_at | integer |  | No |
| id | string |  | Yes |
| inputs | object<br>[ object ]<br>string<br>integer<br>number<br>boolean |  | No |
| outputs | object |  | No |
| status | string |  | Yes |
| total_steps | integer |  | No |
| total_tokens | integer |  | No |
| workflow_id | string |  | Yes |
