# Conversation

## Get Shared Conversation Details

> Fetch the active share-link details for a conversation without mutating anything.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"SharedConversationResponse":{"properties":{"shared_conversation_id":{"type":"string","title":"Shared Conversation Id"},"last_updated_time":{"type":"string","format":"date-time","title":"Last Updated Time"},"expired_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired Time"}},"type":"object","required":["shared_conversation_id","last_updated_time"],"title":"SharedConversationResponse","description":"Response model for sharing a conversation.\n\nAttributes:\n    shared_conversation_id (str): The unique identifier for the shared conversation.\n    last_updated_time (datetime): The last time the shared conversation was updated.\n    expired_time (datetime | None): When the shared conversation access id expires. Defaults to None (no expiry)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}/share":{"get":{"tags":["Conversation"],"summary":"Get Shared Conversation Details","description":"Fetch the active share-link details for a conversation without mutating anything.","operationId":"get_shared_conversation_details_conversations__conversation_id__share_get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharedConversationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Or Update Shared Conversation

> Create a shareable link for a conversation with optional expiry days.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"Body_create_or_update_shared_conversation_conversations__conversation_id__share_post":{"properties":{"expiry_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expiry Days"}},"type":"object","title":"Body_create_or_update_shared_conversation_conversations__conversation_id__share_post"},"SharedConversationResponse":{"properties":{"shared_conversation_id":{"type":"string","title":"Shared Conversation Id"},"last_updated_time":{"type":"string","format":"date-time","title":"Last Updated Time"},"expired_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired Time"}},"type":"object","required":["shared_conversation_id","last_updated_time"],"title":"SharedConversationResponse","description":"Response model for sharing a conversation.\n\nAttributes:\n    shared_conversation_id (str): The unique identifier for the shared conversation.\n    last_updated_time (datetime): The last time the shared conversation was updated.\n    expired_time (datetime | None): When the shared conversation access id expires. Defaults to None (no expiry)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}/share":{"post":{"tags":["Conversation"],"summary":"Create Or Update Shared Conversation","description":"Create a shareable link for a conversation with optional expiry days.","operationId":"create_or_update_shared_conversation_conversations__conversation_id__share_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_create_or_update_shared_conversation_conversations__conversation_id__share_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharedConversationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Shared Conversation

> Get a shared conversation by its share ID, including all messages and attachments.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"paths":{"/conversations/shared/{shared_conversation_id}":{"get":{"tags":["Conversation"],"summary":"Get Shared Conversation","description":"Get a shared conversation by its share ID, including all messages and attachments.","operationId":"get_shared_conversation_conversations_shared__shared_conversation_id__get","parameters":[{"name":"shared_conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Shared Conversation Id"}},{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string","default":"en","title":"Accept-Language"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSharedConversationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"GetSharedConversationResponse":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages"},"conversation":{"$ref":"#/components/schemas/Conversation"},"last_updated_time":{"type":"string","format":"date-time","title":"Last Updated Time"},"expired_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired Time"},"attachments":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Attachments","default":[]},"chatbot":{"additionalProperties":true,"type":"object","title":"Chatbot"}},"type":"object","required":["messages","conversation","last_updated_time","chatbot"],"title":"GetSharedConversationResponse","description":"Response model for getting a shared conversation.\n\nAttributes:\n    messages (list[Message]): List of messages in the shared conversation.\n    conversation (Conversation): The conversation details.\n    conversation_title (str): The title of the conversation by the time of sharing.\n    last_updated_time (datetime): The last time the shared conversation was updated.\n    expired_time (datetime | None): When the shared conversation access id expires.\n    attachments (list[dict[str, Any]]): List of attachments in the conversation.\n    chatbot (dict[str, Any]): The chatbot associated with the conversation."},"Message":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"role":{"$ref":"#/components/schemas/MessageRole"},"content":{"type":"string","title":"Content"},"deanonymized_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deanonymized Content"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"is_active":{"type":"boolean","title":"Is Active"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"feedback":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["conversation_id","role","content","created_time","is_active"],"title":"Message","description":"Message model."},"MessageRole":{"type":"string","enum":["user","assistant"],"title":"MessageRole","description":"Enum for Message Type."},"Conversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time"},"is_active":{"type":"boolean","title":"Is Active"},"is_anonymized":{"type":"boolean","title":"Is Anonymized"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"deanonymized_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Deanonymized Mapping","default":{}},"first_matching_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message Id"},"first_matching_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","user_id","title","created_time","updated_time","is_active","is_anonymized","chatbot_id"],"title":"Conversation","description":"Conversation model.\n\nAttributes:\n    id (str): The conversation ID.\n    user_id (str): The user ID.\n    title (str | None): The conversation title.\n    created_time (datetime): The creation time.\n    updated_time (datetime): The last update time.\n    is_active (bool): Whether the conversation is active.\n    chatbot_id (str): The chatbot ID.\n    is_anonymized (bool): Whether the conversation is anonymized.\n    deanonymized_mapping (dict[str, str]): Mapping of anonymized to original values.\n    first_matching_message_id (str | None): First message ID that matches search query.\n    first_matching_message (str | None): First message that matches search query.\n    metadata_ (dict[str, Any] | None): Additional metadata for the conversation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## Delete Shared Conversation

> Delete a shared conversation by its share ID.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/shared/{shared_conversation_id}":{"delete":{"tags":["Conversation"],"summary":"Delete Shared Conversation","description":"Delete a shared conversation by its share ID.","operationId":"delete_shared_conversation_conversations_shared__shared_conversation_id__delete","parameters":[{"name":"shared_conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Shared Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Shared Conversation Conversations Shared  Shared Conversation Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get All Shared Conversations

> Get all shared conversations of current user.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"SharedConversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"conversation_title":{"type":"string","title":"Conversation Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"last_updated_time":{"type":"string","format":"date-time","title":"Last Updated Time"},"expired_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expired Time"},"first_matching_word":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Word"},"is_active":{"type":"boolean","title":"Is Active","default":true},"mind_map":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mind Map"}},"type":"object","required":["id","user_id","conversation_id","conversation_title","created_time","last_updated_time"],"title":"SharedConversation","description":"shared conversation model.\n\nAttributes:\n    id (str): The shared conversation ID.\n    user_id (str): The user ID.\n    conversation_id (str): The conversation ID.\n    conversation_title (str): The conversation title by the time of sharing.\n    created_time (datetime): The creation time.\n    last_updated_time (datetime): The last snapshot time.\n    expired_time (datetime | None): The expiration time for the shared conversation.\n    first_matching_word (str | None): The first matching word.\n    is_active (bool): Whether the shared conversation is active.\n    mind_map (str | None): The JSON string of mind map for the shared conversation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/shared":{"get":{"tags":["Conversation"],"summary":"Get All Shared Conversations","description":"Get all shared conversations of current user.","operationId":"get_all_shared_conversations_conversations_shared_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search query for conversation title","title":"Query"},"description":"Search query for conversation title"},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/SharedConversation"}},"title":"Response Get All Shared Conversations Conversations Shared Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Clone Shared Conversation

> Clone a shared conversation to a new conversation.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"Body_clone_shared_conversation_conversations_shared__shared_conversation_id__clone_post":{"properties":{"user_id":{"type":"string","title":"User Id"},"new_conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Conversation Id"},"old_parent_id":{"type":"string","title":"Old Parent Id"}},"type":"object","required":["user_id","old_parent_id"],"title":"Body_clone_shared_conversation_conversations_shared__shared_conversation_id__clone_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/shared/{shared_conversation_id}/clone":{"post":{"tags":["Conversation"],"summary":"Clone Shared Conversation","description":"Clone a shared conversation to a new conversation.","operationId":"clone_shared_conversation_conversations_shared__shared_conversation_id__clone_post","parameters":[{"name":"shared_conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Shared Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_clone_shared_conversation_conversations_shared__shared_conversation_id__clone_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get All Conversations

> Get all conversations of current user, optionally filtered by a search query and chatbot\_id.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"GetConversationsResponse":{"properties":{"conversations":{"items":{"$ref":"#/components/schemas/Conversation"},"type":"array","title":"Conversations"},"cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"},"conversations_count":{"type":"integer","title":"Conversations Count"}},"type":"object","required":["conversations","conversations_count"],"title":"GetConversationsResponse","description":"Response model for getting all conversations.\n\nAttributes:\n    conversations (list[Conversation]): List of conversations.\n    cursor (Optional[str]): A cursor for pagination, if applicable.\n    conversations_count (int): The total count of conversations."},"Conversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time"},"is_active":{"type":"boolean","title":"Is Active"},"is_anonymized":{"type":"boolean","title":"Is Anonymized"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"deanonymized_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Deanonymized Mapping","default":{}},"first_matching_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message Id"},"first_matching_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","user_id","title","created_time","updated_time","is_active","is_anonymized","chatbot_id"],"title":"Conversation","description":"Conversation model.\n\nAttributes:\n    id (str): The conversation ID.\n    user_id (str): The user ID.\n    title (str | None): The conversation title.\n    created_time (datetime): The creation time.\n    updated_time (datetime): The last update time.\n    is_active (bool): Whether the conversation is active.\n    chatbot_id (str): The chatbot ID.\n    is_anonymized (bool): Whether the conversation is anonymized.\n    deanonymized_mapping (dict[str, str]): Mapping of anonymized to original values.\n    first_matching_message_id (str | None): First message ID that matches search query.\n    first_matching_message (str | None): First message that matches search query.\n    metadata_ (dict[str, Any] | None): Additional metadata for the conversation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations":{"get":{"tags":["Conversation"],"summary":"Get All Conversations","description":"Get all conversations of current user, optionally filtered by a search query and chatbot_id.","operationId":"get_all_conversations_conversations_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string","description":"Search query for conversation title or message content","default":"","title":"Query"},"description":"Search query for conversation title or message content"},{"name":"chatbot_id","in":"query","required":false,"schema":{"type":"string","description":"Chatbot id for conversation","title":"Chatbot Id"},"description":"Chatbot id for conversation"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pointer to keep track of the last fetched conversations","title":"Cursor"},"description":"Pointer to keep track of the last fetched conversations"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Number of conversations to return per request","title":"Limit"},"description":"Number of conversations to return per request"},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetConversationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Conversation

> Create a new conversation with optional title.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"Body_create_conversation_conversations_post":{"properties":{"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"model_name":{"type":"string","title":"Model Name","default":"openai/gpt-4o-mini"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"metadata_":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["user_id","chatbot_id"],"title":"Body_create_conversation_conversations_post"},"CreateConversationResponse":{"properties":{"conversation":{"$ref":"#/components/schemas/Conversation"}},"type":"object","required":["conversation"],"title":"CreateConversationResponse","description":"Response model for creating a conversation.\n\nAttributes:\n    conversation (Conversation): The created conversation details."},"Conversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time"},"is_active":{"type":"boolean","title":"Is Active"},"is_anonymized":{"type":"boolean","title":"Is Anonymized"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"deanonymized_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Deanonymized Mapping","default":{}},"first_matching_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message Id"},"first_matching_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","user_id","title","created_time","updated_time","is_active","is_anonymized","chatbot_id"],"title":"Conversation","description":"Conversation model.\n\nAttributes:\n    id (str): The conversation ID.\n    user_id (str): The user ID.\n    title (str | None): The conversation title.\n    created_time (datetime): The creation time.\n    updated_time (datetime): The last update time.\n    is_active (bool): Whether the conversation is active.\n    chatbot_id (str): The chatbot ID.\n    is_anonymized (bool): Whether the conversation is anonymized.\n    deanonymized_mapping (dict[str, str]): Mapping of anonymized to original values.\n    first_matching_message_id (str | None): First message ID that matches search query.\n    first_matching_message (str | None): First message that matches search query.\n    metadata_ (dict[str, Any] | None): Additional metadata for the conversation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations":{"post":{"tags":["Conversation"],"summary":"Create Conversation","description":"Create a new conversation with optional title.","operationId":"create_conversation_conversations_post","parameters":[{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_create_conversation_conversations_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConversationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Conversation Messages

> Get messages from a specific conversation with optional limit and date filtering.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"GetConversationMessagesResponse":{"properties":{"conversation":{"$ref":"#/components/schemas/Conversation"},"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages"},"attachments":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Attachments"}},"type":"object","required":["conversation","messages","attachments"],"title":"GetConversationMessagesResponse","description":"Response model for getting conversation messages.\n\nAttributes:\n    conversation (Conversation): The conversation details.\n    messages (list[Message]): List of messages in the conversation.\n    attachments (list[dict[str, Any]]): List of attachments related to the messages."},"Conversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time"},"is_active":{"type":"boolean","title":"Is Active"},"is_anonymized":{"type":"boolean","title":"Is Anonymized"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"deanonymized_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Deanonymized Mapping","default":{}},"first_matching_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message Id"},"first_matching_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","user_id","title","created_time","updated_time","is_active","is_anonymized","chatbot_id"],"title":"Conversation","description":"Conversation model.\n\nAttributes:\n    id (str): The conversation ID.\n    user_id (str): The user ID.\n    title (str | None): The conversation title.\n    created_time (datetime): The creation time.\n    updated_time (datetime): The last update time.\n    is_active (bool): Whether the conversation is active.\n    chatbot_id (str): The chatbot ID.\n    is_anonymized (bool): Whether the conversation is anonymized.\n    deanonymized_mapping (dict[str, str]): Mapping of anonymized to original values.\n    first_matching_message_id (str | None): First message ID that matches search query.\n    first_matching_message (str | None): First message that matches search query.\n    metadata_ (dict[str, Any] | None): Additional metadata for the conversation."},"Message":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"role":{"$ref":"#/components/schemas/MessageRole"},"content":{"type":"string","title":"Content"},"deanonymized_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deanonymized Content"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"is_active":{"type":"boolean","title":"Is Active"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"feedback":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["conversation_id","role","content","created_time","is_active"],"title":"Message","description":"Message model."},"MessageRole":{"type":"string","enum":["user","assistant"],"title":"MessageRole","description":"Enum for Message Type."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}":{"get":{"tags":["Conversation"],"summary":"Get Conversation Messages","description":"Get messages from a specific conversation with optional limit and date filtering.","operationId":"get_conversation_messages_conversations__conversation_id__get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"}},{"name":"max_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Date"}},{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string","default":"en","title":"Accept-Language"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetConversationMessagesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Conversation

> Delete a specific conversation by ID and remove any associated attachments and vector DB documents.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}":{"delete":{"tags":["Conversation"],"summary":"Delete Conversation","description":"Delete a specific conversation by ID and remove any associated attachments and vector DB documents.","operationId":"delete_conversation_conversations__conversation_id__delete","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Conversation Conversations  Conversation Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Rename Conversation

> Rename an existing conversation with a new title.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"Body_rename_conversation_conversations__conversation_id__patch":{"properties":{"title":{"type":"string","title":"Title"}},"type":"object","required":["title"],"title":"Body_rename_conversation_conversations__conversation_id__patch"},"CreateConversationResponse":{"properties":{"conversation":{"$ref":"#/components/schemas/Conversation"}},"type":"object","required":["conversation"],"title":"CreateConversationResponse","description":"Response model for creating a conversation.\n\nAttributes:\n    conversation (Conversation): The created conversation details."},"Conversation":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"created_time":{"type":"string","format":"date-time","title":"Created Time"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time"},"is_active":{"type":"boolean","title":"Is Active"},"is_anonymized":{"type":"boolean","title":"Is Anonymized"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"deanonymized_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Deanonymized Mapping","default":{}},"first_matching_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message Id"},"first_matching_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Matching Message"},"metadata_":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["id","user_id","title","created_time","updated_time","is_active","is_anonymized","chatbot_id"],"title":"Conversation","description":"Conversation model.\n\nAttributes:\n    id (str): The conversation ID.\n    user_id (str): The user ID.\n    title (str | None): The conversation title.\n    created_time (datetime): The creation time.\n    updated_time (datetime): The last update time.\n    is_active (bool): Whether the conversation is active.\n    chatbot_id (str): The chatbot ID.\n    is_anonymized (bool): Whether the conversation is anonymized.\n    deanonymized_mapping (dict[str, str]): Mapping of anonymized to original values.\n    first_matching_message_id (str | None): First message ID that matches search query.\n    first_matching_message (str | None): First message that matches search query.\n    metadata_ (dict[str, Any] | None): Additional metadata for the conversation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}":{"patch":{"tags":["Conversation"],"summary":"Rename Conversation","description":"Rename an existing conversation with a new title.","operationId":"rename_conversation_conversations__conversation_id__patch","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_rename_conversation_conversations__conversation_id__patch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConversationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Conversations

> Delete multiple conversations matching the specified criteria, including user\_id, chatbot\_id and optional conversation\_ids.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"DeleteConversationsRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"chatbot_id":{"type":"string","title":"Chatbot Id"},"conversation_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Conversation Ids"}},"type":"object","required":["user_id","chatbot_id"],"title":"DeleteConversationsRequest","description":"Request model for deleting conversations."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/delete":{"post":{"tags":["Conversation"],"summary":"Delete Conversations","description":"Delete multiple conversations matching the specified criteria, including user_id, chatbot_id and optional conversation_ids.","operationId":"delete_conversations_conversations_delete_post","parameters":[{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteConversationsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Conversations Conversations Delete Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Generate Conversation Title

> Generate a title for an existing conversation based on its content.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Backend API","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]},{"APIKeyHeader":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"auth/token"}}},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Tenant-ID"}},"schemas":{"Body_generate_conversation_title_conversations__conversation_id__generate_title_post":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"Body_generate_conversation_title_conversations__conversation_id__generate_title_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/conversations/{conversation_id}/generate-title":{"post":{"tags":["Conversation"],"summary":"Generate Conversation Title","description":"Generate a title for an existing conversation based on its content.","operationId":"generate_conversation_title_conversations__conversation_id__generate_title_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"__Secure-next-auth.session-token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"  Secure-Next-Auth.Session-Token"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_generate_conversation_title_conversations__conversation_id__generate_title_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Generate Conversation Title Conversations  Conversation Id  Generate Title Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```
