Chat

Upload Chat Files

post

Upload Chat Files

This endpoint allows authenticated users to upload one file for processing in chat sessions. The file is stored temporarily in session storage and their content is extracted for use with AI models.


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To upload files for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Query Parameters

Parameter Name
Type
Required
Description

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.


Form Data Parameters

Parameter Name
Type
Required
Description

prompt_file

UploadFile

Yes

One file to upload for processing.


Responses

Status Code
Description

200

Success - Files successfully uploaded and processed. Returns file names and session ID.

400

Bad Request - No files provided, total size exceeds 10MB, token limit exceeded, acting user not in teams, or file processing failed.

401

Unauthorized - Invalid or missing API key.

422

Validation Error - Invalid file format or parameters.


Technical Process

The endpoint performs the following operations:

  1. File Validation: Checks if files are provided and within size limits (10MB total)

  2. Session Management: Creates or retrieves a session with 30-minute expiration

  3. User Authorization: Validates acting user permissions for external usage

  4. File Processing: Extracts text content from files based on user plan (Enterprise vs standard)

  5. Token Counting: Validates total tokens against model limits using combined text from all files

  6. Session Storage: Stores processed files in session for later retrieval


Example Use Case

A user wants to upload multiple documents (PDF, Word, Text) to analyze them with AI models in a chat session. The files are processed, their content is extracted, and the system ensures the total text doesn't exceed the token limits of the selected models.


Example Request


Example Response (Success - 200)

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
acting_user_emailstringOptional

Email of the end user initiating this action

Header parameters
accept-languagestring · enumRequiredPossible values:
Body
prompt_fileany ofOptionalDefault: []
string · binaryOptional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat/files/upload

Remove Chat File

delete

Remove Chat File

This endpoint allows authenticated users to remove a specific file from their chat session. The file is deleted from the session storage, freeing up space and reducing the token count for subsequent AI model interactions.


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To remove files for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Query Parameters

Parameter Name
Type
Required
Description

files_id

string

Yes

File IDs to remove. Can be: files_id=id1,id2

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.


Responses

Status Code
Description

200

Success - File successfully removed or not found in session. Returns updated file list and session ID.

400

Bad Request - The acting user is not in the owner's teams.

401

Unauthorized - Invalid or missing API key.


Technical Process

The endpoint performs the following operations:

  1. Session Identification: Locates the session using session ID and model names

  2. User Authorization: Validates acting user permissions for external usage

  3. File Removal: Removes the specified file from session storage if it exists

  4. Session Update: Updates the session with the modified file list

  5. Idempotent Operation: Returns success even if the file or session doesn't exist


Example Use Case

A user wants to remove a specific document from their chat session because it's no longer relevant or they want to free up space for new files. The system removes the file and returns the updated list of remaining files in the session.


Example Request


Example Response (Success - 200)

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
files_idstringRequired

File IDs to remove. Can be: files_id=id1,id2

acting_user_emailstringOptional

Email of the end user initiating this action

Header parameters
accept-languagestring · enumRequiredPossible values:
Responses
chevron-right
200

Successful Response

application/json
delete
/chat/files/remove

List Chat Files

get

List Chat Files

This endpoint allows authenticated users to retrieve the list of files currently stored in their chat session. It provides visibility into which files are available for AI model processing.


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To list files for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Query Parameters

Parameter Name
Type
Required
Description

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.


Responses

Status Code
Description

200

Success - Returns the list of files in the session. Returns empty list if no files or session found.

400

Bad Request - The acting user is not in the owner's teams.

401

Unauthorized - Invalid or missing API key.


Technical Process

The endpoint performs the following operations:

  1. Session Identification: Locates the session using session ID and model names

  2. User Authorization: Validates acting user permissions for external usage

  3. File Retrieval: Extracts the list of filenames from session storage

  4. Graceful Handling: Returns empty lists with appropriate messages for non-existent sessions or files


Example Use Case

A user wants to check which files are currently available in their chat session before starting a conversation with AI models. This helps them verify that all intended documents have been successfully uploaded and are ready for processing.


Example Request


Example Response (Success with Files - 200)

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
acting_user_emailstringOptional

Email of the end user initiating this action

Header parameters
accept-languagestring · enumRequiredPossible values:
Responses
chevron-right
200

Successful Response

application/json
get
/chat/files/list

Stop Chat Interaction with streaming

post

Stop Chat Generation Stream

This endpoint allows authenticated users to stop ongoing streaming chat interactions with AI models. It gracefully terminates model generation processes for specified models, either locally or on remote GPU instances, and provides real-time status updates through server-sent events (SSE).


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To stop streaming for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

selected_models

List[string]

Yes

List of model names for which to stop generation.

session_id

string

Yes

The session ID of the chat to stop.

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

prompt

string

No

The original prompt that was being processed (for remote GPU instances).

secret

string

No

Encryption secret for secure models.

history

List[ChatHistory]

No

Chat history context (for remote GPU instances).

language_pref

string

No

Language preference for the response.

history_period

string

No

Time period context for the chat history.

enable_thinking

boolean

No

Whether thinking mode was enabled.


Responses

Status Code
Description

200

Success - Returns Server-Sent Events (SSE) stream with stop status updates for each model.

400

Bad Request - The acting user is not in the owner's teams, or error stopping remote GPU instances.

401

Unauthorized - Invalid or missing API key.

404

Not Found - No active task found for the specified model.

422

Validation Error - The request body contains invalid data.


Response Format (SSE Stream)

The endpoint returns Server-Sent Events with the following event types:

  • stop: Successful stop event for a model

  • error: Error event when stopping fails


Technical Process

The endpoint performs the following operations:

  1. Model Identification: Determines which models need to be stopped (local or remote GPU instances)

  2. Remote GPU Handling: For Understand AI models, calls remote GPU VM stop endpoints

  3. Local Task Management: For local models, cancels tasks and sets stop events

  4. Real-time Streaming: Returns SSE stream with progress updates for each model

  5. Graceful Termination: Ensures proper cleanup of resources and task cancellation


Example Use Case

A user wants to stop an ongoing chat generation that is taking too long or producing undesired results. They specify which models to stop, and the system provides real-time feedback on the stopping process for each model through an event stream.


Example Request


Example Response (SSE Stream)

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
selected_modelsany ofOptional
string[]Optional
or
nullOptional
promptany ofOptional
stringOptional
or
nullOptional
language_prefany ofOptional
stringOptional
or
nullOptional
historyany ofOptionalDefault: []
or
nullOptional
history_periodany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
chained_session_idany ofOptional
stringOptional
or
nullOptional
enable_thinkingany ofOptionalDefault: false
booleanOptional
or
nullOptional
enable_web_searchany ofOptionalDefault: false
booleanOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
session_idany ofOptional
stringOptional
or
nullOptional
file_idsany ofOptional
string[]Optional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat/stream/stop

Initiate chat interaction with streaming

post

Initiate Chat Interaction with Streaming

This endpoint allows authenticated users to initiate real-time chat interactions with multiple AI models simultaneously. It supports streaming responses via Server-Sent Events (SSE), enabling live token-by-token generation from various AI models including local models and remote GPU instances.


Authentication

  • Type: Bearer Token (API_KEY)

  • Required: Yes

  • Header: Authorization: Bearer <API_KEY>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To initiate chat for an external user, the API key used for authentication must itself be configured for external usage (i.e., is_external_usage must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

selected_models

List[string]

Yes

List of model names to use for chat generation.

prompt

string

Yes

The user's input prompt/message.

session_id

string

No

Existing session ID for continuing conversations. If not provided, a new session is created.

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

secret

string

No

Encryption secret required for enterprise/encrypted models.

language_pref

string

No

Language preference for the response (e.g., "en-US", "fr-FR").

history

List[HistorySchema]

No

Chat history context for maintaining conversation state.

history_period

string

No

Time period context for historical data filtering.

enable_thinking

boolean

No

Whether to enable thinking/reasoning mode for models that support it.

file_ids

List[string]

No

List of file ids.


Responses

Status Code
Description

200

Success - Returns Server-Sent Events (SSE) stream with real-time token generation from all selected models.

400

Bad Request - No quota available, missing secret for encrypted models, acting user not in teams, model not found, or other validation errors.

401

Unauthorized - Invalid or missing API key.

422

Validation Error - The request body contains invalid data.


Response Format (SSE Stream)

The endpoint returns Server-Sent Events with the following event types:

  • token: Individual token generation event

  • assistant_message_complete: Complete message generation

  • error: Error event during generation


Technical Process

The endpoint performs the following complex operations:

  1. Session Management: Creates or retrieves chat sessions with 30-minute expiration

  2. Model Initialization: Loads and initializes conversation chains for each selected model

  3. File Processing: Integrates uploaded file content into the prompt context

  4. Quota Validation: Checks user quota limits before processing

  5. Hybrid Processing: Handles both local models and remote GPU instances (Understand AI)

  6. Real-time Streaming: Manages multiple concurrent model generations with SSE

  7. Security Enforcement: Validates encryption secrets for enterprise models


Example Use Case

A user wants to get real-time responses from multiple AI models (GPT-4, Claude, and custom models) for a complex query. They provide their prompt, selected models, and optional session context. The system streams responses from all models simultaneously, allowing the user to see responses as they're generated.


Example Request


Example Response (SSE Stream)

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
selected_modelsany ofOptional
string[]Optional
or
nullOptional
promptany ofOptional
stringOptional
or
nullOptional
language_prefany ofOptional
stringOptional
or
nullOptional
historyany ofOptionalDefault: []
or
nullOptional
history_periodany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
chained_session_idany ofOptional
stringOptional
or
nullOptional
enable_thinkingany ofOptionalDefault: false
booleanOptional
or
nullOptional
enable_web_searchany ofOptionalDefault: false
booleanOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
session_idany ofOptional
stringOptional
or
nullOptional
file_idsany ofOptional
string[]Optional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat/stream/sse

Initiate chat interaction optimized

post

Initiate Chat Interaction

This endpoint allows authenticated users to initiate chat interactions with multiple AI models simultaneously. It handles session management, quota validation, file processing, and response generation from various AI models including local models and remote GPU instances.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <JWT_TOKEN>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To initiate chat for an external user, the API key used for authentication must itself be configured for external usage (i.e., accept_external_client must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

selected_models

List[string]

Yes

List of model names to use for chat generation.

prompt

string

Yes

The user's input prompt/message.

session_id

string

No

Existing session ID for continuing conversations. If not provided, a new session is created.

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

secret

string

No

Encryption secret required for enterprise/encrypted models.

language_pref

string

No

Language preference for the response (e.g., "en-US", "fr-FR").

history

List[HistorySchema]

No

Chat history context for maintaining conversation state.

history_period

string

No

Time period context for historical data filtering.

chained_session_id

string

No

Identifier for chained session processing.

file_ids

List[string]

No

List of file ids.


Responses

Status Code
Description

200

Success - Returns chat responses from all selected models in JSON format.

400

Bad Request - No quota available, missing secret for encrypted models, acting user not in teams, model not found, or other validation errors.

401

Unauthorized - Invalid or missing authentication token.

422

Validation Error - The request body contains invalid data.


Response Format (JSON)

The endpoint returns a JSON response with the following structure:


Technical Process

The endpoint performs the following complex operations:

  1. Session Management: Creates or retrieves chat sessions with 30-minute expiration

  2. Model Initialization: Loads and initializes conversation chains for each selected model

  3. File Processing: Integrates uploaded file content into the prompt context

  4. Quota Validation: Checks user quota limits before processing

  5. Hybrid Processing: Handles both local models and remote GPU instances (Understand AI)

  6. Security Enforcement: Validates encryption secrets for enterprise models and external user permissions

  7. Team Validation: Verifies acting users are part of the owner's teams for external usage


Example Use Case

A user wants to get responses from multiple AI models (GPT-4, Claude, and custom models) for a complex query. They provide their prompt, selected models, and optional session context. The system processes the request through appropriate models and returns all responses in a structured format.


Example Request


Example Response

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
selected_modelsany ofOptional
string[]Optional
or
nullOptional
promptany ofOptional
stringOptional
or
nullOptional
language_prefany ofOptional
stringOptional
or
nullOptional
historyany ofOptionalDefault: []
or
nullOptional
history_periodany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
chained_session_idany ofOptional
stringOptional
or
nullOptional
enable_thinkingany ofOptionalDefault: false
booleanOptional
or
nullOptional
enable_web_searchany ofOptionalDefault: false
booleanOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
session_idany ofOptional
stringOptional
or
nullOptional
file_idsany ofOptional
string[]Optional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat_optimized

Initiate chat interaction

post

Initiate Chat Interaction

This endpoint allows authenticated users to initiate chat interactions with multiple AI models simultaneously. It handles session management, quota validation, file processing, and response generation from various AI models including local models and remote GPU instances.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <JWT_TOKEN>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To initiate chat for an external user, the API key used for authentication must itself be configured for external usage (i.e., accept_external_client must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

selected_models

List[string]

Yes

List of model names to use for chat generation.

prompt

string

Yes

The user's input prompt/message.

session_id

string

No

Existing session ID for continuing conversations. If not provided, a new session is created.

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

secret

string

No

Encryption secret required for enterprise/encrypted models.

language_pref

string

No

Language preference for the response (e.g., "en-US", "fr-FR").

history

List[HistorySchema]

No

Chat history context for maintaining conversation state.

history_period

string

No

Time period context for historical data filtering.

chained_session_id

string

No

Identifier for chained session processing.

file_ids

List[string]

No

List of file ids.


Responses

Status Code
Description

200

Success - Returns chat responses from all selected models in JSON format.

400

Bad Request - No quota available, missing secret for encrypted models, acting user not in teams, model not found, or other validation errors.

401

Unauthorized - Invalid or missing authentication token.

422

Validation Error - The request body contains invalid data.


Response Format (JSON)

The endpoint returns a JSON response with the following structure:


Technical Process

The endpoint performs the following complex operations:

  1. Session Management: Creates or retrieves chat sessions with 30-minute expiration

  2. Model Initialization: Loads and initializes conversation chains for each selected model

  3. File Processing: Integrates uploaded file content into the prompt context

  4. Quota Validation: Checks user quota limits before processing

  5. Hybrid Processing: Handles both local models and remote GPU instances (Understand AI)

  6. Security Enforcement: Validates encryption secrets for enterprise models and external user permissions

  7. Team Validation: Verifies acting users are part of the owner's teams for external usage


Example Use Case

A user wants to get responses from multiple AI models (GPT-4, Claude, and custom models) for a complex query. They provide their prompt, selected models, and optional session context. The system processes the request through appropriate models and returns all responses in a structured format.


Example Request


Example Response

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
selected_modelsany ofOptional
string[]Optional
or
nullOptional
promptany ofOptional
stringOptional
or
nullOptional
language_prefany ofOptional
stringOptional
or
nullOptional
historyany ofOptionalDefault: []
or
nullOptional
history_periodany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
chained_session_idany ofOptional
stringOptional
or
nullOptional
enable_thinkingany ofOptionalDefault: false
booleanOptional
or
nullOptional
enable_web_searchany ofOptionalDefault: false
booleanOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
session_idany ofOptional
stringOptional
or
nullOptional
file_idsany ofOptional
string[]Optional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat

Retrieve chat history

post

Retrieve Chat History

This endpoint allows authenticated users to retrieve their chat history from multiple AI models. It supports filtering by time period and handles encrypted conversations for enterprise models.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <JWT_TOKEN>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To access history for an external user, the API key used for authentication must itself be configured for external usage (i.e., accept_external_client must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

selected_models

List[string]

Yes

List of model names to retrieve history from.

selected_period

string

Yes

Time period for filtering the history (e.g., "last_7_days", "last_month").

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

secret

string

No

Encryption secret required for accessing encrypted conversation history.


Responses

Status Code
Description

200

Success - Returns chat history from all selected models in structured format.

400

Bad Request - Acting user not in teams, invalid time period, or other validation errors.

401

Unauthorized - Invalid or missing authentication token.

403

Forbidden - Insufficient permissions to access the requested history.

422

Validation Error - The request body contains invalid data.


Response Format (JSON)

The endpoint returns a JSON array with the following structure:


Technical Process

The endpoint performs the following operations:

  1. Authentication Validation: Verifies user credentials and external usage permissions

  2. Team Membership Check: Validates that acting users are part of the owner's teams for external usage

  3. Time Range Calculation: Converts the selected period into specific start and end timestamps

  4. History Retrieval: Fetches conversation history from storage for each selected model

  5. Encryption Handling: Manages decryption of conversations when a secret is provided

  6. Structured Formatting: Organizes the history into a standardized response format


Example Use Case

A user wants to review their past conversations with multiple AI models from the last week. They specify the models and time period, and optionally provide an encryption secret if they have enterprise models. The system returns all relevant conversations in a structured format.


Example Request


Example Response

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
selected_modelsany ofOptional
string[]Optional
or
nullOptional
selected_periodany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
post
/chat/history

Submit feedback

post

Submit Chat Feedback

This endpoint allows authenticated users to submit feedback on AI model responses. It supports encrypted feedback storage for enterprise models with different encryption modes based on model privacy settings.


Authentication

  • Type: Bearer Token

  • Required: Yes

  • Header: Authorization: Bearer <JWT_TOKEN>

  • Dependency: Depends(APIKeyBearer())

  • External Usage Requirement: To submit feedback for an external user, the API key used for authentication must itself be configured for external usage (i.e., accept_external_client must be true).


Request Headers

Header Name
Type
Required
Description

accept_language

LanguageEnum

Yes

Specifies the preferred language for response messages (e.g., "fr-FR").


Body Parameters (JSON Schema)

Parameter Name
Type
Required
Description

model

string

Yes

Name of the model that generated the response being rated.

doc_id

string

Yes

Document identifier associated with the conversation.

prompt

string

Yes

The original user prompt that generated the response.

response

string

Yes

The model response being rated.

status

string

Yes

Feedback status (e.g., "helpful", "incorrect", "inappropriate").

user_feedback

object

Yes

Detailed feedback object containing user ratings and comments.

acting_user_email

string

No

Email of the user acting on the owner's behalf (for external usage). Requires the authenticating API key to have external usage enabled.

secret

string

No

Encryption secret required for providing feedback on encrypted models.


Responses

Status Code
Description

200

Success - Feedback was successfully stored. Returns confirmation message.

400

Bad Request - Acting user not in teams, missing secret for encrypted models, model not found, or other validation errors.

401

Unauthorized - Invalid or missing authentication token.

403

Forbidden - Insufficient permissions to submit feedback for the specified model.

422

Validation Error - The request body contains invalid data.


Response Format (JSON)

The endpoint returns a JSON response with the following structure:


Technical Process

The endpoint performs the following complex operations:

  1. Authentication Validation: Verifies user credentials and external usage permissions

  2. Team Membership Check: Validates that acting users are part of the owner's teams for external usage

  3. Model Verification: Checks if the specified model exists and retrieves its encryption settings

  4. Encryption Handling: Applies appropriate encryption based on model type:

    • Private Encrypted Models: Uses Key B encryption with user-provided secret

    • Team Encrypted Models: Uses ephemeral key encryption with owner's public key

    • Public Models: Stores feedback in plaintext

  5. Secure Storage: Saves encrypted or plaintext feedback to the database with metadata

  6. Document Reference: Associates feedback with the specific conversation document


Encryption Modes

Model Type
Encryption Method
Secret Required

Private Encrypted

AES-GCM with Key B derived from user secret

Yes

Team Encrypted

Ephemeral key exchange with owner's public key

Yes

Public

No encryption (plaintext)

No


Example Use Case

A user wants to provide feedback on a model response they received. They specify whether the response was helpful, provide additional comments, and include the original prompt and response. For encrypted models, they provide the necessary secret to encrypt their feedback securely.


Example Request


Example Response

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
accept-languagestring · enumRequiredPossible values:
Body
modelany ofOptional
stringOptional
or
nullOptional
promptany ofOptional
stringOptional
or
nullOptional
responseany ofOptional
stringOptional
or
nullOptional
statusany ofOptional
stringOptional
or
nullOptional
secretany ofOptional
stringOptional
or
nullOptional
doc_idany ofOptional
stringOptional
or
nullOptional
acting_user_emailany ofOptional
stringOptional
or
nullOptional
Responses
chevron-right
200

Successful Response

application/json
Responseany
post
/chat/feedback

No content

Last updated