API-DELETE-v1-chat-sessions-id

abstract

Deletes a chat session and all its messages via ORM-level cascade. Called from the sidebar's session delete action.


🔒 Authentication

None.


🛠️ Technical Specification

Request

PropertyValue
MethodDELETE
Path/api/v1/chat/sessions/{session_id}
Tags["Chat"]

📦 Path Parameters

ParamTypeRequiredDescription
session_idUUIDYesSession to delete

Logic Flow

📤 Responses

StatusBodyCondition
200 OK{ message: "Session deleted successfully" }Session found and deleted
404 Not Found{ detail: "Session not found" }session_id not in DB
RoleFile
Routerbackend/app/api/v1/chat.py :: remove_session()
Delete logicbackend/app/services/chat_history_service.py :: delete_session()
ORM cascadebackend/app/models/chat.py :: ChatSession.messagescascade="all, delete-orphan"
UI triggerfrontend/src/components/nav-session.tsxuseChatStore.removeSession()

RoleLink
Create sessionAPI-POST-v1-chat-sessions
List sessionsAPI-GET-v1-chat-sessions
DB cascade detailsDB - chatmessage
Zustand storeStore - ChatStore