{ "openapi": "3.1.0", "info": { "title": "AI-CHATBOT-Y1 API", "description": "API for chatbot services", "version": "1.0.0" }, "paths": { "/mcp/queries": { "post": { "tags": [ "AI" ], "summary": "Create Mcp Query", "description": "Create an MCP query and return a complete response", "operationId": "create_mcp_query_mcp_queries_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AskMCPRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AskMCPResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "HTTPBearer": [] } ] } }, "/mcp/queries/stream": { "post": { "tags": [ "AI" ], "summary": "Stream Mcp Query", "description": "Create an MCP query and stream the response", "operationId": "stream_mcp_query_mcp_queries_stream_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AskMCPRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "HTTPBearer": [] } ] } }, "/mcp/status": { "get": { "tags": [ "AI" ], "summary": "Mcp Status", "description": "Check MCP connection status", "operationId": "mcp_status_mcp_status_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "HTTPBearer": [] } ] } }, "/chats": { "post": { "tags": [ "chat" ], "summary": "Create Chat", "description": "Create a new chat for the authenticated user", "operationId": "create_chat_chats_post", "security": [ { "HTTPBearer": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatCreate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "get": { "tags": [ "chat" ], "summary": "Get Chats", "description": "Get all chats for the authenticated user", "operationId": "get_chats_chats_get", "security": [ { "HTTPBearer": [] } ], "parameters": [ { "name": "userId", "in": "query", "required": true, "schema": { "type": "string", "description": "User identifier", "title": "Userid" }, "description": "User identifier" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatGetResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/chats/{chatId}": { "get": { "tags": [ "chat" ], "summary": "Get Chat By Id", "description": "Get a specific chat by chatId for the authenticated user", "operationId": "get_chat_by_id_chats__chatId__get", "security": [ { "HTTPBearer": [] } ], "parameters": [ { "name": "chatId", "in": "path", "required": true, "schema": { "type": "string", "title": "Chatid" } }, { "name": "userId", "in": "query", "required": true, "schema": { "type": "string", "description": "User identifier", "title": "Userid" }, "description": "User identifier" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatGetByIdResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "chat" ], "summary": "Delete Chat", "description": "Delete a specific chat", "operationId": "delete_chat_chats__chatId__delete", "security": [ { "HTTPBearer": [] } ], "parameters": [ { "name": "chatId", "in": "path", "required": true, "schema": { "type": "string", "title": "Chatid" } }, { "name": "userId", "in": "query", "required": true, "schema": { "type": "string", "description": "User identifier", "title": "Userid" }, "description": "User identifier" } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "patch": { "tags": [ "chat" ], "summary": "Rename Chat", "description": "Rename a specific chat", "operationId": "rename_chat_chats__chatId__patch", "security": [ { "HTTPBearer": [] } ], "parameters": [ { "name": "chatId", "in": "path", "required": true, "schema": { "type": "string", "title": "Chatid" } }, { "name": "userId", "in": "query", "required": true, "schema": { "type": "string", "description": "User identifier", "title": "Userid" }, "description": "User identifier" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatRenameRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/chats/{chatId}/messages": { "post": { "tags": [ "chat" ], "summary": "Add Message", "description": "Add a message to a specific chat", "operationId": "add_message_chats__chatId__messages_post", "security": [ { "HTTPBearer": [] } ], "parameters": [ { "name": "chatId", "in": "path", "required": true, "schema": { "type": "string", "title": "Chatid" } }, { "name": "userId", "in": "query", "required": true, "schema": { "type": "string", "description": "User identifier", "title": "Userid" }, "description": "User identifier" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatMessageCreate" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChatResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/health": { "get": { "summary": "Health Check", "description": "Health check endpoint", "operationId": "health_check_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/": { "get": { "summary": "Root", "description": "Root endpoint with API information", "operationId": "root__get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } } }, "components": { "schemas": { "AskMCPRequest": { "properties": { "conversation": { "items": { "$ref": "#/components/schemas/ConversationDTO" }, "type": "array", "title": "Conversation" }, "IdDonVi": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Iddonvi" }, "max_iterations": { "type": "integer", "title": "Max Iterations", "default": 3 } }, "type": "object", "required": [ "conversation" ], "title": "AskMCPRequest" }, "AskMCPResponse": { "properties": { "response": { "type": "string", "title": "Response" } }, "type": "object", "required": [ "response" ], "title": "AskMCPResponse" }, "Chat": { "properties": { "_id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "messages": { "items": { "$ref": "#/components/schemas/Message" }, "type": "array", "title": "Messages" }, "userId": { "type": "string", "title": "Userid" }, "createdAt": { "type": "string", "format": "date-time", "title": "Createdat" }, "updatedAt": { "type": "string", "format": "date-time", "title": "Updatedat" } }, "type": "object", "required": [ "name", "userId", "createdAt", "updatedAt" ], "title": "Chat", "description": "Chat model", "example": { "createdAt": "2025-01-01T00:00:00", "messages": [ { "content": "Hello", "role": "user", "timestamp": 1609459200000 } ], "name": "New Chat", "updatedAt": "2025-01-01T00:00:00", "userId": "user123" } }, "ChatCreate": { "properties": { "userId": { "type": "string", "title": "Userid" }, "name": { "type": "string", "title": "Name", "default": "New Chat" } }, "type": "object", "required": [ "userId" ], "title": "ChatCreate", "description": "Request model for creating a chat", "example": { "name": "My Chat", "userId": "user123" } }, "ChatCreateResponse": { "properties": { "success": { "type": "boolean", "title": "Success" }, "message": { "type": "string", "title": "Message" }, "chatId": { "type": "string", "title": "Chatid" } }, "type": "object", "required": [ "success", "message" ], "title": "ChatCreateResponse", "description": "Response model for creating a chat" }, "ChatGetByIdResponse": { "properties": { "success": { "type": "boolean", "title": "Success" }, "data": { "$ref": "#/components/schemas/Chat" } }, "type": "object", "required": [ "success" ], "title": "ChatGetByIdResponse", "description": "Response model for getting a chat by ID" }, "ChatGetResponse": { "properties": { "success": { "type": "boolean", "title": "Success" }, "data": { "items": { "$ref": "#/components/schemas/Chat" }, "type": "array", "title": "Data" } }, "type": "object", "required": [ "success" ], "title": "ChatGetResponse", "description": "Response model for getting chats" }, "ChatMessageCreate": { "properties": { "message": { "$ref": "#/components/schemas/Message" } }, "type": "object", "required": [ "message" ], "title": "ChatMessageCreate", "description": "Request model for adding a message to a chat via POST", "example": { "message": { "content": "Hello", "role": "user", "timestamp": 1609459200000 } } }, "ChatRenameRequest": { "properties": { "name": { "type": "string", "title": "Name" } }, "type": "object", "required": [ "name" ], "title": "ChatRenameRequest", "description": "Request model for renaming a chat via PATCH", "example": { "name": "Updated Chat Name" } }, "ChatResponse": { "properties": { "success": { "type": "boolean", "title": "Success" }, "message": { "type": "string", "title": "Message" } }, "type": "object", "required": [ "success", "message" ], "title": "ChatResponse", "description": "Response model for renaming a chat" }, "ConversationDTO": { "properties": { "role": { "type": "string", "title": "Role" }, "content": { "type": "string", "title": "Content" } }, "type": "object", "required": [ "role", "content" ], "title": "ConversationDTO" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "Message": { "properties": { "role": { "type": "string", "title": "Role" }, "content": { "type": "string", "title": "Content" }, "timestamp": { "type": "number", "title": "Timestamp" } }, "type": "object", "required": [ "role", "content", "timestamp" ], "title": "Message", "description": "Message model", "example": { "content": "Hello, how are you?", "role": "user", "timestamp": 1609459200000 } }, "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" } }, "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" } } } }